nl_tokens: Return a function for matching based on the given pattern and options .
pl_tokens: function matcher ( pattern , opts ) { // pattern is a function if ( typeof pattern === 'function' ) { return pattern ; } // pattern is a regex if ( pattern instanceof RegExp ) { return function ( fp ) { return pattern . test ( fp ) ; } ; } if ( typeof pattern !== 'string' ) { throw new TypeError ( msg ( 'matcher' , 'pattern' , 'a string, regex, or function' ) ) ; } // strings, all the way down... pattern = utils . unixify ( pattern , opts ) ; // pattern is a non-glob string if ( ! utils . isGlob ( <mask> ) ) { return utils . matchPath ( pattern , opts ) ; } // pattern is a glob string var re = makeRe ( pattern , opts ) ; // `matchBase` is defined if ( opts && opts . matchBase ) { return utils . hasFilename ( re , opts ) ; } // `matchBase` is not defined return function ( fp ) { fp = utils . unixify ( fp , opts ) ; return re . test ( fp ) ; } ; }