1 # Fined [![Build Status][travis-image]][travis-url] [![Build Status][appveyor-image]][appveyor-url]
3 > Find a file given a declaration of locations
5 [![NPM](https://nodei.co/npm/fined.png)](https://nodei.co/npm/fined/)
10 var fined = require('fined');
12 fined({ path: 'path/to/file', extensions: ['.js', '.json'] });
13 // => { path: '/absolute/path/to/file.js', extension: '.js' } (if file exists)
14 // => null (if file does not exist)
20 'rc': 'default-rc-loader',
21 '.yml': 'default-yml-loader',
25 fined({ path: '.' }, opts);
26 // => { path: '/absolute/of/cwd/.app.yml', extension: { '.yml': 'default-yml-loader' } }
28 fined({ path: '~', extensions: { 'rc': 'some-special-rc-loader' } }, opts);
29 // => { path: '/User/home/.apprc', extension: { 'rc': 'some-special-rc-loader' } }
34 ### fined(pathObj, opts) => object | null
38 * **pathObj** [string | object] : a path setting for finding a file.
39 * **opts** [object] : a plain object supplements `pathObj`.
41 `pathObj` and `opts` can have same properties:
43 * **path** [string] : a path string.
44 * **name** [string] : a basename.
45 * **extensions**: [string | array | object] : extensions.
46 * **cwd**: a base directory of `path` and for finding up.
47 * **findUp**: [boolean] : a flag to find up.
51 This function returns a plain object which consists of following properties if a file exists otherwise null.
53 * **path** : an absolute path
54 * **extension** : a string or a plain object of extension.
62 [npm-image]: http://img.shields.io/badge/npm-v0.0.0-blue.svg
63 [npm-url]: https://www.npmjs.org/package/fined
64 [travis-image]: https://travis-ci.org/js-cli/fined.svg?branch=master
65 [travis-url]: https://travis-ci.org/js-cli/fined
66 [appveyor-image]: https://ci.appveyor.com/api/projects/status/github/js-cli/fined?branch=master&svg=true
67 [appveyor-url]: https://ci.appveyor.com/project/js-cli/fined