climb-lookup

1.0.0 • Public • Published

Climb lookup

a lookup climbing recursively file like a require.

Usage

npm install climb-lookup --save
import {lookup, lookupSync, getPaths} from 'climb-lookup';
 
console.log(lookupSync('package.json')); // /path/to/package.json

API Reference

Why?

It may fail to read the configuration file due to process.cwd().

cd my-project
tree . -L 1
# . 
# ├── src 
# ├── test 
# └── package.json 
node -e "require(process.cwd()+'/package.json')" # ok 
 
cd test
node -e "require(process.cwd()+'/package.json')" # Error: Cannot find module './test/package.json' 

climb-lookup is lookup climbing recursively file, like a require.

cd my-project
tree . -L 1
# . 
# ├── src 
# ├── test 
# └── package.json 
node -e "require(require('climb-lookup').lookupSync('package.json'))" # ok 
 
cd test
node -e "require(require('climb-lookup').lookupSync('package.json'))" # ok 

Test

git clone https://github.com/59naga/climb-lookup.git
cd climb-lookup
 
npm install
npm test

License

MIT

Package Sidebar

Install

npm i climb-lookup

Weekly Downloads

31

Version

1.0.0

License

MIT

Last publish

Collaborators

  • 59naga