2.0.1 • Published 10 years ago

rooted v2.0.1

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

rooted

Build Status Coverage Status npm version

NPM

Requiring modules/folders/files in the right way

Installation

npm i rooted --save

Usage

////// bad
var data    = require('../../../../data.json');
var helpers = require('../../../helpers');

///// good
// will build the path starting from the root directory of your application
// and require the respective file/folder/module
var rooted  = require('rooted');
var data    = rooted('data.json');
var helpers = rooted('helpers');

You can also get string representing the absolute path of the file/folder, passing true as the second argument.

var rooted  = require('rooted');
var data    = rooted('data.json', true);

console.log(typeof data); // "string"

Tests

make test

License

MIT License © Eric Douglas

2.0.1

10 years ago

2.0.0

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago