nl_tokens: Read directory and initialize JavaScript files .
pl_tokens: function read ( filepath , options ) { if ( 'string' !== is ( filepath ) ) return fabricator ( filepath , options ) ; if ( options . source ) filepath = path . resolve ( options . source , filepath ) ; // // Check if the provided string is a JS file or when recursion is not allowed. // if ( js ( filepath ) || options . recursive === false ) return [ init ( filepath , path . basename ( filepath , '.js' ) , options ) ] ; // // Read the directory, only process files. // if ( ! fs . existsSync ( filepath ) ) return false ; return <mask> . readdirSync ( filepath ) . map ( function locate ( file ) { file = path . resolve ( filepath , file ) ; var stat = fs . statSync ( file ) ; if ( stat . isDirectory ( ) && fs . existsSync ( path . join ( file , 'index.js' ) ) ) { // // Use the directory name instead of `index` for name as it probably has // more meaning then just `index` as a name. // return init ( path . join ( file , 'index.js' ) , path . basename ( file , '.js' ) , options ) ; } // // Only allow JS files, init determines if it is a constructible instance. // if ( ! stat . isFile ( ) || ! js ( file ) ) return ; return init ( file , path . basename ( file , '.js' ) , options ) ; } ) ; }