dependents / dependents/node-filing-cabinet

allow non-singleton usage

Open
#92 2 comments 0 reactions 0 assignees View on GitHub
help wanted
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.