1.0.1 • Published 5 years ago

lazy-dir v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

lazy-dir

Lazy define current directory

Travis CI node npm PRs


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