58 lines
1.9 KiB
Markdown
58 lines
1.9 KiB
Markdown
|
|
# lookup-path [](https://www.npmjs.com/package/lookup-path) [](https://travis-ci.org/jonschlinkert/lookup-path)
|
||
|
|
|
||
|
|
> Attempt to resolve the absolute filepath to a file and verify that it exists.
|
||
|
|
|
||
|
|
You might also be interested in [is-absolute](https://github.com/jonschlinkert/is-absolute).
|
||
|
|
|
||
|
|
## Install
|
||
|
|
|
||
|
|
Install with [npm](https://www.npmjs.com/):
|
||
|
|
|
||
|
|
```sh
|
||
|
|
$ npm i lookup-path --save
|
||
|
|
```
|
||
|
|
|
||
|
|
## Usage
|
||
|
|
|
||
|
|
```js
|
||
|
|
var lookup = require('lookup-path');
|
||
|
|
console.log(lookup('package.json'));
|
||
|
|
//=> '~/package.json'
|
||
|
|
|
||
|
|
// pass a cwd as a second parameter
|
||
|
|
lookup('foo.js', 'test');
|
||
|
|
```
|
||
|
|
|
||
|
|
## Related projects
|
||
|
|
|
||
|
|
* [is-absolute](https://www.npmjs.com/package/is-absolute): Returns true if a file path is absolute. | [homepage](https://github.com/jonschlinkert/is-absolute)
|
||
|
|
* [is-relative](https://www.npmjs.com/package/is-relative): Returns `true` if the path appears to be relative. | [homepage](https://github.com/jonschlinkert/is-relative)
|
||
|
|
* [is-windows](https://www.npmjs.com/package/is-windows): Returns true if the platform is windwows. | [homepage](https://github.com/jonschlinkert/is-windows)
|
||
|
|
|
||
|
|
## Running tests
|
||
|
|
|
||
|
|
Install dev dependencies:
|
||
|
|
|
||
|
|
```sh
|
||
|
|
$ npm i -d && npm test
|
||
|
|
```
|
||
|
|
|
||
|
|
## Contributing
|
||
|
|
|
||
|
|
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/lookup-path/issues/new).
|
||
|
|
|
||
|
|
## Author
|
||
|
|
|
||
|
|
**Jon Schlinkert**
|
||
|
|
|
||
|
|
* [github/jonschlinkert](https://github.com/jonschlinkert)
|
||
|
|
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
||
|
|
|
||
|
|
## License
|
||
|
|
|
||
|
|
Copyright © 2016 [Jon Schlinkert](https://github.com/jonschlinkert)
|
||
|
|
Released under the [MIT license](https://github.com/jonschlinkert/lookup-path/blob/master/LICENSE).
|
||
|
|
|
||
|
|
***
|
||
|
|
|
||
|
|
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on February 07, 2016._
|