README
lazy-dir
Lazy define current directory
Install
$ npm install lazy-dir
Usage
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
API
module
);
require('lazy-dir')(- Params:
module
:<NodeJS.Module>
(required)
- Returns:
<object>
[...paths]
)
.pwd(- Params:
...paths
:<string[]>
(optional)
- Returns:
<string>
- Example:
dir.pwd('a', 'b', 'c'); // eq: path.resolve(process.cwd(), 'a', 'b', 'c')
[...paths]
)
.here(- Params:
...paths
:<string[]>
(optional)
- Returns:
<string>
- Example:
dir.here('a', 'b', 'c'); // eq: path.resolve(__dirname, 'a', 'b', 'c')
License
MIT © Guntur Poetra