@giancarl021/locate
v0.1.7
Published
Get a path from root of project or cwd
Downloads
37
Readme
locate
Locate a file based on root of project or cwd
Installation
npm:
npm install --save @giancarl021/locate
yarn:
yarn add @giancarl021/locate
Usage
From root:
const locate = require('@giancarl021/locate');
const databasePath = locate('data/database');
// Will return <root>/data/database, independent of the file who calls it
From CWD:
const locate = require('@giancarl021/locate');
const package = locate('package.json', true);
// Will return <process.cwd()>/package.json, independent of the file who calls it