nl_tokens: TODO : have to restrict max count to improve response Append more to word list according to a filter or expected size .
pl_tokens: function appendMore ( word , list , nextKdx , expectedSize , filter , ticket ) { if ( ticket !== mutual_ticket ) { throw 'force terminated' ; } if ( filter ) { if ( _trail . count < expectedSize && nextKdx && nextKdx . first_word . substr ( 0 , word . length ) === word ) { return loadKeys ( nextKdx ) . delay ( 30 ) . then ( function ( more ) { _trail . offset = 0 ; _trail . block = nextKdx . index ; Array . prototype . push . apply ( list , more . filter ( filter , _trail ) ) ; return appendMore ( word , list , KEY_INDEX [ nextKdx . index + 1 ] , expectedSize , filter , ticket ) ; } ) ; } else { if ( list . length === 0 ) { _trail . exhausted = true ; } return resolve ( list ) ; } } else { var shortage = expectedSize - list . length ; if ( shortage > 0 && nextKdx ) { _trail . block = nextKdx . index ; return loadKeys ( nextKdx ) . then ( function ( more ) { _trail . offset = 0 ; _trail . pos = Math . min ( shortage , more . length ) ; Array . prototype . push . apply ( list , more . slice ( 0 , shortage ) ) ; return appendMore ( <mask> , list , KEY_INDEX [ nextKdx . index + 1 ] , expectedSize , filter , ticket ) ; } ) ; } else { if ( _trail . pos > expectedSize ) { _trail . pos = expectedSize ; } list = list . slice ( 0 , expectedSize ) ; _trail . count = list . length ; _trail . total += _trail . count ; return resolve ( list ) ; } } }