curried-paths
v0.0.2
Published
Let's you create functions for paths that behave like path.join
Downloads
1
Readme
node-curried-paths
This lets you create functions that behave similarly to path.join(), rooted at specified directories. You can then create new functions, recursively, for subdirectories.
For example:
var curriedPath = require('curried-paths');
var process = require('process');
// Curried path for the current working directory
var work = curriedPath(process.cwd());
work(); //=> string representation of cwd
work('sub'); //=> `cwd`/sub
work('sub', 'sub'); //=> `cwd`/sub/sub
work('..', '..'); //=> grandparent of `cwd`
// Create a new function for a subdirectory
var test = work.sub('test');
test(); //=> `cwd`/test
test('sub1', 'sub2'); //=> `cwd`/test/sub1/sub2