nl_tokens: Expands wildcards with matching ( ie . existing ) file names . For example : expand ( [ file * . js ] ) = [ file1 . js file2 . js ... ] ( if the files file1 . js file2 . js etc exist in the current dir )
pl_tokens: function expand ( list ) { var expanded = [ ] ; list . forEach ( function ( listEl ) { // Wildcard present on directory names ? if ( listEl . search ( / \*[^\/]*\/ / ) > - 1 || listEl . search ( / \*\*[^\/]*\/ / ) > - 1 ) { var match = listEl . match ( / ^([^*]+\/|)(.*) / ) ; var root = match [ 1 ] ; var rest = match [ 2 ] ; var restRegex = rest . replace ( / \*\* / g , ".*" ) . replace ( / \* / g , "[^\\/]*" ) ; restRegex = new RegExp ( restRegex ) ; _ls ( '-R' , <mask> ) . filter ( function ( e ) { return restRegex . test ( e ) ; } ) . forEach ( function ( file ) { expanded . push ( file ) ; } ) ; } // Wildcard present on file names ? else if ( listEl . search ( / \* / ) > - 1 ) { _ls ( '' , listEl ) . forEach ( function ( file ) { expanded . push ( file ) ; } ) ; } else { expanded . push ( listEl ) ; } } ) ; return expanded ; }