npm.io
1.1.0 • Published 11 years ago

caroot

Licence
MIT
Version
1.1.0
Deps
1
Vulns
0
Weekly
0

caroot

Replaces a caret with the root path (closest package.json)

Usage

caroot(caretedPath, currentPath[, rootSubDirectory])


var caroot = require('caroot');

// assume we are 2 levels deeper than package.json

caroot('^foo', __dirname);

// returns '../../foo'


// also takes an optional root sub directory

caroot('^foo', __dirname, './scripts');

// returns '../foo'

Keywords