nl_tokens: Matches string with an array returns the word and the index it was found on and sorts the match instances based on the index property of the match .
pl_tokens: function ( <mask> , text ) { var matchedWords = [ ] ; forEach ( words , function ( word ) { word = stripSpaces ( word ) ; if ( ! matchWordInSentence ( word , text ) ) { return matchedWords ; } matchedWords = matchedWords . concat ( getIndicesByWord ( word , text ) ) ; } ) ; matchedWords = matchedWords . sort ( function ( a , b ) { if ( a . index < b . index ) { return - 1 ; } if ( a . index > b . index ) { return 1 ; } return 0 ; } ) ; return matchedWords ; }