# look-up

> Faster drop-in replacement for find-up and findup-sync.

Latest version **0.8.3** (published 2016-02-04) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install look-up
pnpm add look-up
yarn add look-up
bun add look-up
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.8.3 |
| Published | 2016-02-04 |
| First published | 2014-10-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 5 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Jon Schlinkert |
| Maintainers | jonschlinkert, doowb |
| Keywords | file, find, find-up, findup, glob, look, match, package, package.json, pattern, resolve, search, sync, up |

## Links

- npm: https://www.npmjs.com/package/look-up
- Repository: https://github.com/jonschlinkert/look-up
- Issues: https://github.com/jonschlinkert/look-up/issues
- npm.io page: https://npm.io/package/look-up

## Dependencies (5)

- [is-glob](https://npm.io/package/is-glob.md) ^2.0.1
- [lazy-cache](https://npm.io/package/lazy-cache.md) ^1.0.3
- [micromatch](https://npm.io/package/micromatch.md) ^2.3.7
- [resolve-dir](https://npm.io/package/resolve-dir.md) ^0.1.0
- [normalize-path](https://npm.io/package/normalize-path.md) ^2.0.1

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 0.8.3 (latest) — 2016-02-04
- 0.8.2 — 2015-11-21
- 0.8.1 — 2015-10-04
- 0.8.0 — 2015-10-04
- 0.7.2 — 2015-09-12
- 0.7.1 — 2015-04-07
- 0.7.0 — 2015-03-10
- 0.6.0 — 2015-02-05
- 0.5.2 — 2015-02-01
- 0.5.0 — 2015-01-19
- 0.4.1 — 2014-12-18
- 0.4.0 — 2014-12-18
- 0.3.1 — 2014-12-13
- 0.3.0 — 2014-12-13
- 0.2.3 — 2014-12-10
- … 5 more at https://npm.io/package/look-up/versions

## README

# look-up [![NPM version](https://badge.fury.io/js/look-up.svg)](http://badge.fury.io/js/look-up)  [![Build Status](https://travis-ci.org/jonschlinkert/look-up.svg)](https://travis-ci.org/jonschlinkert/look-up)

> Faster drop-in replacement for find-up and findup-sync.

## Install

Install with [npm](https://www.npmjs.com/)

```sh
$ npm i look-up --save
```

See the [benchmarks](#run-benchmarks) or [unit tests](./test.js).

## Usage

```js
var lookup = require('look-up');
lookup('package.json');
//=> '/Users/jonschlinkert/dev/look-up/package.json'
```

look-up will recurse _up from the cwd_ until it finds the given file.

```js
lookup('package.json', { cwd: 'foo/bar' });
//=> '/Users/jonschlinkert/dev/look-up/package.json'
```

Glob patterns are also supported (string or array):

```js
lookup(['*.json', '*.foo'], { cwd: 'foo/bar' });
//=> '/Users/jonschlinkert/dev/look-up/package.json'
```

## Running benchmarks

Benchmarks were run on [mac and windows](https://github.com/jonschlinkert/look-up/issues/1). look-up is 5x-20x faster than [findup-sync](https://github.com/cowboy/node-findup-sync) and 3x faster than [find-up](https://github.com/sindresorhus/find-up)

**Note** that [find-up](https://github.com/sindresorhus/find-up) does not support glob patterns, so these benchmarks only include arguments that are supported by all three libs.

As of November 20, 2015:

```bash
#1: deep-close
  findup-sync x 5,797 ops/sec ±1.66% (90 runs sampled)
  findup x 22,972 ops/sec ±0.82% (92 runs sampled)
  lookup x 64,389 ops/sec ±0.75% (92 runs sampled)

#2: deep-far
  findup-sync x 2,165 ops/sec ±1.01% (92 runs sampled)
  findup x 8,250 ops/sec ±0.78% (96 runs sampled)
  lookup x 12,730 ops/sec ±0.93% (92 runs sampled)

#3: nested
  findup-sync x 21,603 ops/sec ±0.76% (93 runs sampled)
  findup x 103,427 ops/sec ±0.93% (95 runs sampled)
  lookup x 381,425 ops/sec ±0.91% (91 runs sampled)

#4: shallow
  findup-sync x 6,565 ops/sec ±0.66% (92 runs sampled)
  findup x 23,674 ops/sec ±0.89% (95 runs sampled)
  lookup x 57,029 ops/sec ±0.83% (93 runs sampled)
```

To run the [benchmarks](./benchmark), install dev dependencies:

```bash
npm i -d && npm run benchmark
```

## Related

* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern.… [more](https://www.npmjs.com/package/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob)
* [look-up-cli](https://www.npmjs.com/package/look-up-cli): Find a file matching a pattern by walking up parent directories | [homepage](https://github.com/lydell/look-up-cli#readme)
* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. Just… [more](https://www.npmjs.com/package/micromatch) | [homepage](https://github.com/jonschlinkert/micromatch)

## Running tests

Install dev dependencies:

```sh
$ npm i -d && npm test
```

## Coverage

As of November 20, 2015:

```
Statements : 100% (57/57)
Branches   : 100% (26/26)
Functions  : 100% (5/5)
Lines      : 100% (55/55)
```

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/look-up/issues/new).

## Author

**Jon Schlinkert**

+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

## License

Copyright © 2015 Jon Schlinkert
Released under the MIT license.

***

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on November 20, 2015._

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