A sync glob / minimatch / RegExp call with a gruntjs -like `expand` of patterns, with minimum depepndencies. Derived from gruntjs's v0.4.1 `file.expand`

npm install glob-expand
5 downloads in the last day
72 downloads in the last week
282 downloads in the last month


A (sync) glob / minimatch / RegExp call using gruntjs's file.expand.

It has only a minimum of dependencies (glob & lodash).

Its almost a copy/paste of 2 functions from Gruntjs's v0.4.1 grunt/file.js

Additionally you can use minimatch Strings or RegExps, either as an Array or as arguments. *


npm install glob-expand


    expand = require 'glob-expand'

    # may the original node-glob be with you (should you need it):
    glob = expand.glob

    expand {filter: 'isFile', cwd: '../'}, ['**/*.*', '!exclude/these/**/*.*']
    # returns all files in cwd ['file1', 'file2',...] but excluding
    # those under directory 'exclude/these'

    # These are the same
    expand {cwd: '../..'}, ['**/*.*', '!node_modules/**/*.*']
    expand {cwd: '../..'}, '**/*.*', '!node_modules/**/*.*'

    # These are the same too:
    expand {}, ['**/*.*', '!**/*.js']
    expand {}, '**/*.*', '!**/*.js'
    expand ['**/*.*', '!**/*.js']
    expand '**/*.*', '!**/*.js'

    # Using Regular Expressions:
    expand '**/*.js', /.*\.(coffee\.md|litcoffee|coffee)$/i, '!DRAFT*.*'
    # -> returns all `.js`, `.coffee`, `` & `.litcoffee` files,
    #    excluding those starting with 'DRAFT'

See gruntjs files configuration and node-glob for more options.

Sorry no tests, I assumed gruntjs's tests are sufficient ;-)

npm loves you