summaryrefslogtreecommitdiff
path: root/lib/path.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/path.js')
-rw-r--r--lib/path.js17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/path.js b/lib/path.js
index 9958630d7b..c920580fec 100644
--- a/lib/path.js
+++ b/lib/path.js
@@ -112,7 +112,9 @@ if (isWindows) {
}
// Skip empty and invalid entries
- if (typeof path !== 'string' || !path) {
+ if (typeof path !== 'string') {
+ throw new TypeError('Arguments to path.resolve must be strings');
+ } else if(!path) {
continue;
}
@@ -199,9 +201,9 @@ if (isWindows) {
exports.join = function() {
function f(p) {
if (typeof p !== 'string') {
- throw new TypeError('Arguments to join must be strings');
+ throw new TypeError('Arguments to path.join must be strings');
}
- return p && typeof p === 'string';
+ return p;
}
var paths = Array.prototype.filter.call(arguments, f);
@@ -307,7 +309,9 @@ if (isWindows) {
var path = (i >= 0) ? arguments[i] : process.cwd();
// Skip empty and invalid entries
- if (typeof path !== 'string' || !path) {
+ if (typeof path !== 'string') {
+ throw new TypeError('Arguments to path.resolve must be strings');
+ } else if (!path) {
continue;
}
@@ -353,9 +357,9 @@ if (isWindows) {
var paths = Array.prototype.slice.call(arguments, 0);
return exports.normalize(paths.filter(function(p, index) {
if (typeof p !== 'string') {
- throw new TypeError('Arguments to join must be strings');
+ throw new TypeError('Arguments to path.join must be strings');
}
- return p && typeof p === 'string';
+ return p;
}).join('/'));
};
@@ -454,6 +458,7 @@ exports.existsSync = util.deprecate(function(path) {
if (isWindows) {
exports._makeLong = function(path) {
+ // Note: this will *probably* throw somewhere.
if (typeof path !== 'string')
return path;