Bachir Soussi Chiadmi 0611418f7a added whole system from ola4doc | 7 年之前 | |
---|---|---|
.. | ||
LICENSE | 7 年之前 | |
README.md | 7 年之前 | |
index.js | 7 年之前 | |
package.json | 7 年之前 |
Find a file given a declaration of locations
var fined = require('fined');
fined({ path: 'path/to/file', extensions: ['.js', '.json'] });
// => { path: '/absolute/path/to/file.js', extension: '.js' } (if file exists)
// => null (if file does not exist)
var opts = {
name: '.app',
cwd: '.',
extensions: {
'rc': 'default-rc-loader',
'.yml': 'default-yml-loader',
},
};
fined({ path: '.' }, opts);
// => { path: '/absolute/of/cwd/.app.yml', extension: { '.yml': 'default-yml-loader' } }
fined({ path: '~', extensions: { 'rc': 'some-special-rc-loader' } }, opts);
// => { path: '/User/home/.apprc', extension: { 'rc': 'some-special-rc-loader' } }
pathObj
.pathObj
and opts
can have same properties:
path
and for finding up.This function returns a plain object which consists of following properties if a file exists otherwise null.
MIT