# fined

> Find a file given a declaration of locations.

Latest version **2.0.0** (published 2021-10-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install fined
pnpm add fined
yarn add fined
bun add fined
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2021-10-31 |
| First published | 2016-06-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/fined) |
| Module format | CommonJS |
| Node | >= 10.13.0 |
| Dependencies | 5 |
| Unpacked size | 8.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Gulp Team |
| Maintainers | sttk, phated |
| Keywords | find, lookup, config |

## Links

- npm: https://www.npmjs.com/package/fined
- Repository: https://github.com/gulpjs/fined
- Homepage: https://github.com/gulpjs/fined#readme
- Issues: https://github.com/gulpjs/fined/issues
- npm.io page: https://npm.io/package/fined

## Dependencies (5)

- [object.pick](https://npm.io/package/object.pick.md) ^1.3.0
- [expand-tilde](https://npm.io/package/expand-tilde.md) ^2.0.2
- [parse-filepath](https://npm.io/package/parse-filepath.md) ^1.0.2
- [is-plain-object](https://npm.io/package/is-plain-object.md) ^5.0.0
- [object.defaults](https://npm.io/package/object.defaults.md) ^1.1.0

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2021-10-31
- 1.2.0 — 2019-04-21
- 1.1.1 — 2018-12-10
- 1.1.0 — 2017-06-18
- 1.0.2 — 2016-10-05
- 1.0.1 — 2016-06-19
- 1.0.0 — 2016-06-16

## README

<p align="center">
  <a href="http://gulpjs.com">
    <img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
  </a>
</p>

# fined

[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]

Find a file given a declaration of locations.

## Usage

```js
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

<!-- prettier-ignore-start -->
[downloads-image]: https://img.shields.io/npm/dm/fined.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/fined
[npm-image]: https://img.shields.io/npm/v/fined.svg?style=flat-square

[ci-url]: https://github.com/gulpjs/fined/actions?query=workflow:dev
[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/fined/dev?style=flat-square

[coveralls-url]: https://coveralls.io/r/gulpjs/fined
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/fined/master.svg
<!-- prettier-ignore-end -->

---
_Source: https://npm.io/package/fined · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
