cd
chdir in chainer fashion + read file
Last updated 13 years ago by sipware .
Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install cd 
SYNC missed versions from official npm registry.

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);

Current Tags

  • 0.3.3                                ...           latest (13 years ago)

12 Versions

  • 0.3.3                                ...           13 years ago
  • 0.3.2                                ...           13 years ago
  • 0.3.1                                ...           13 years ago
  • 0.3.0                                ...           13 years ago
  • 0.2.2                                ...           13 years ago
  • 0.2.0                                ...           13 years ago
  • 0.1.3                                ...           13 years ago
  • 0.1.2                                ...           13 years ago
  • 0.1.1                                ...           13 years ago
  • 0.1.0                                ...           13 years ago
  • 0.0.2                                ...           13 years ago
  • 0.0.1                                ...           13 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |