Skip to content

Commit

Permalink
path: assert path.join() arguments equally
Browse files Browse the repository at this point in the history
Re-use `assertPath()` when asserting path argument types in `join()`
as throughout the rest of the `path` module.

This also ensures the same error message generated for posix as for
win32.

PR-URL: #2159
Reviewed-By: Roman Reiss <me@silverwind.io>
  • Loading branch information
phillipj authored and silverwind committed Jul 11, 2015
1 parent bd01603 commit 2ba8460
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,9 +477,7 @@ posix.join = function() {
var path = '';
for (var i = 0; i < arguments.length; i++) {
var segment = arguments[i];
if (typeof segment !== 'string') {
throw new TypeError('Arguments to path.join must be strings');
}
assertPath(segment);
if (segment) {
if (!path) {
path += segment;
Expand Down

0 comments on commit 2ba8460

Please sign in to comment.