cd
v0.3.3
Published
chdir in chainer fashion + read file
Downloads
99,761
Readme
cd
Change directory in chaining fashion.
Rules:
1. Reading .json file will strip comments and converte into JSON object.
2. Reading .js file is equivalent of require('dir/to/file')
3. Other files are just read.
4. Supply file as argument on last call. No chaning afterwards.
5. Module is syncro, but if you have good idea how to make it async please let me know.
Usage:
var Cd = require('cd');
var cd = new Cd('.');
// Read lol.json from current directory
var lol = cd('lol.json');
// Read wtf.js from test directory.
var wtf = cd().test('wtf.js');
console.log('wtf:'+JSON.stringify(wtf));
// Chain as you like
var file = cd().dir1().dir2(file_in_dir2);