Comparing version 0.3.0 to 0.5.0
14
lib.js
@@ -7,7 +7,9 @@ /** | ||
_getPath = exports.path = function(name){ | ||
return path.join(__dirname, '../../', name) | ||
var rootPath = path.join(__dirname, '../../'); | ||
_getPath = exports.path = function (name) { | ||
return path.join(rootPath, name); | ||
}; | ||
exports._ = function(name){ | ||
exports._ = function (name) { | ||
console.warn("p2r._ will be deleted, please use p2r.path."); | ||
@@ -17,6 +19,10 @@ return _getPath(name); | ||
exports.require = function(name){ | ||
exports.require = function (name) { | ||
return require(_getPath(name)) | ||
}; | ||
exports.setRoot = function (p) { | ||
rootPath = p; | ||
}; | ||
exports.path = _getPath; |
{ | ||
"name": "p2r", | ||
"version": "0.3.0", | ||
"version": "0.5.0", | ||
"description": "get path relative to project dir", | ||
@@ -5,0 +5,0 @@ "main": "lib.js", |
@@ -10,2 +10,4 @@ ##path-2-root | ||
npm install p2r | ||
*Note: you must not install this package globally!* | ||
@@ -12,0 +14,0 @@ ###Example |
2647
19
30