Closed devmattrick closed 6 years ago
This would have an undesirable effect if two directories have the same name in a nested structure
test
├── one
│ └── two
└── two
└── two
Would be flattened to:
test: {
one: fn,
two: fn
}
Thus omitting two entire folders. The only other option is to convert to an array, that would have an entire different API and use case.
Perhaps there can be namespacing such as one/two/module.js
?
You can do this with userland modules like lodash, don't think its something we want to support with an option.
It'd be great to have some sort of way to "flatten" a requireDir call so all modules are on the same level. I imagine either adding a
flatten
option or allowing users to specifyrecurse: 'flatten'
in the options object.