diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-24 20:03:53 +0400 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-24 23:49:35 +0400 |
commit | 0330bdf5195eb77f04c26a09a8bd2088a261fe53 (patch) | |
tree | 2c13f9f1757bca93e83e425a028dcae78549f40e /lib/path.js | |
parent | 457d52924152c6f2baf2fddbe76a03bca7bdde7c (diff) |
lib: macro-ify type checks
Increases the grep factor. Makes it easier to harmonize type checks
across the code base.
Diffstat (limited to 'lib/path.js')
-rw-r--r-- | lib/path.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/path.js b/lib/path.js index 5cef72fac79..bd5e43793c2 100644 --- a/lib/path.js +++ b/lib/path.js @@ -112,7 +112,7 @@ if (isWindows) { } // Skip empty and invalid entries - if (typeof path !== 'string') { + if (!IS_STRING(path)) { throw new TypeError('Arguments to path.resolve must be strings'); } else if (!path) { continue; @@ -214,7 +214,7 @@ if (isWindows) { // windows version exports.join = function() { function f(p) { - if (typeof p !== 'string') { + if (!IS_STRING(p)) { throw new TypeError('Arguments to path.join must be strings'); } return p; @@ -323,7 +323,7 @@ if (isWindows) { var path = (i >= 0) ? arguments[i] : process.cwd(); // Skip empty and invalid entries - if (typeof path !== 'string') { + if (!IS_STRING(path)) { throw new TypeError('Arguments to path.resolve must be strings'); } else if (!path) { continue; @@ -374,7 +374,7 @@ if (isWindows) { exports.join = function() { var paths = Array.prototype.slice.call(arguments, 0); return exports.normalize(paths.filter(function(p, index) { - if (typeof p !== 'string') { + if (!IS_STRING(p)) { throw new TypeError('Arguments to path.join must be strings'); } return p; @@ -476,7 +476,7 @@ exports.existsSync = util.deprecate(function(path) { if (isWindows) { exports._makeLong = function(path) { // Note: this will *probably* throw somewhere. - if (typeof path !== 'string') + if (!IS_STRING(path)) return path; if (!path) { |