Lazy define current directory
$ npm install lazy-dir
const dir = require('lazy-dir')(module);
console.log(dir.here());
//=> /path/to/project/awesome
console.log(dir.here('foo', 'bar'));
//=> /path/to/project/awesome/foo/bar
- Params:
module
:<NodeJS.Module>
(required)
- Returns:
<object>
- Params:
...paths
:<string[]>
(optional)
- Returns:
<string>
- Example:
dir.pwd('a', 'b', 'c'); // eq: path.resolve(process.cwd(), 'a', 'b', 'c')
- Params:
...paths
:<string[]>
(optional)
- Returns:
<string>
- Example:
dir.here('a', 'b', 'c'); // eq: path.resolve(__dirname, 'a', 'b', 'c')
MIT © Guntur Poetra