Skip to content

Repository files navigation

Require Directory

https://nodei.co/npm/node-require-directory.png?downloads=true

Simple. Recursively iterates over a directory and require all files, returning a nested hash structure of all files. Only requires CoffeeScript and JS files.

Hat tip to require-directory. I just needed something simpler.

npm install node-require-directory

build status

assert=require'assert'require_directory=require'../index'example_directory='./test/example'describe'require-directory', -># This is the directory structure:# example/# - hello.coffee# - hi.coffee# - nested/# - bleep.coffee# - index.coffee# - triple# - yeah.coffee# - index.coffee#it'should work', ->dir=require_directory(example_directory)
assert.equaldir.hello, 'world',
assert.equaldir.hi, 'you',
assert.equaldir.nested.bleep, 'boop'assert.equaldir.nested.triple.yeah, 'woo'assert.equaldir.nested.get, 'bloop'assert.equaldir.nested.triple.index, 'hello'assert.equaldir.nested.DS_Store, undefinedassert.equaldir.nested.unknown_weird_file, undefined

About

Recursively iterates over a directory and requires all files, returning a nested hash structure of all files

Resources

Stars

3 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages