You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Andrea Gaertner 668e16c315 Einkaufsliste application_liste hinzugefügt 3 years ago
..
LICENSE Einkaufsliste application_liste hinzugefügt 3 years ago
README.md Einkaufsliste application_liste hinzugefügt 3 years ago
index.js Einkaufsliste application_liste hinzugefügt 3 years ago
package.json Einkaufsliste application_liste hinzugefügt 3 years ago

README.md

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