0.1.6 • Published 2 years ago

@giancarl021/locate v0.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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