fined (1.2.0)

Published 2026-02-24 13:56:52 +00:00 by atheaadmin

Installation

registry=
npm install fined@1.2.0
"fined": "1.2.0"

About this package

fined

NPM version Downloads Travis Build Status AppVeyor Build Status Coveralls Status Gitter chat

Find a file given a declaration of locations.

Usage

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' } }

API

fined(pathObj, opts) => object | null

Arguments:

  • pathObj [string | object] : a path setting for finding a file.

  • opts [object] : a plain object supplements pathObj.

    pathObj and opts can have same properties:

    • path [string] : a path string.
    • name [string] : a basename.
    • extensions: [string | array | object] : extensions.
    • cwd: a base directory of path and for finding up.
    • findUp: [boolean] : a flag to find up.

Return:

This function returns a plain object which consists of following properties if a file exists otherwise null.

  • path : an absolute path
  • extension : a string or a plain object of extension.

License

MIT

Dependencies

Dependencies

ID Version
expand-tilde ^2.0.2
is-plain-object ^2.0.3
object.defaults ^1.1.0
object.pick ^1.2.0
parse-filepath ^1.0.1

Development Dependencies

ID Version
eslint ^2.13.0
eslint-config-gulp ^3.0.1
expect ^1.20.2
istanbul ^0.4.3
istanbul-coveralls ^1.0.3
mocha ^3.5.3

Keywords

find lookup config
Details
npm
2026-02-24 13:56:52 +00:00
1
Gulp Team
MIT
latest
3.4 KiB
Assets (1)
fined-1.2.0.tgz 3.4 KiB
Versions (1) View all
1.2.0 2026-02-24