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