dependents / dependents/node-filing-cabinet
allow non-singleton usage
- Dominant language
- JavaScript
- Stars
- 87
- Forks
- 47
- PR merge metrics
- No merged PRs in 30d
Description
the `register()` method keeps whatever was registered in memory, but if two libs were using `filing-cabinet` at the same time, they may have differing requirements for custom resolvers. maybe a resolver for `.foo` is different from one to the other, or perhaps one of them should not, under any circumstances, resolve a `.foo` file.
a way to address this would be to provide a factory function, e.g.:
```js
const filingCabinet = require('filing-cabinet');
const cabinet = filingCabinet.create();
cabinet.register('.foo', myFooResolver);
cabinet({partial: 'bar', filename: 'quux.js', directory: '/some/path'}) // works with .foo files
filingCabinet({partial: 'bar', filename: 'quux.js', directory: '/some/path'}) // does not work with .foo files
```
I can send a PR to that effect, or if you have a different idea...
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.