Comparing version 1.0.0 to 1.0.1
16
index.js
var path = require('path'); | ||
var urlJoin = require('url-join'); | ||
@@ -7,6 +8,5 @@ var asArray = require('as-array'); | ||
var exports = module.exports = function () { | ||
var paths = asArray(arguments) | ||
.map(replaceUndefined); | ||
var paths = asArray(arguments).map(replaceUndefined); | ||
return isUrl(paths[0]) | ||
@@ -18,3 +18,3 @@ ? urlJoin.apply(urlJoin, paths) | ||
var isUrl = exports.isUrl = function (url) { | ||
return _isUrl(url) | ||
@@ -27,6 +27,6 @@ || url === 'http://' | ||
var replaceUndefined = exports.replaceUndefined = function (p, idx, paths) { | ||
return (p == undefined || p == null) | ||
return (p === undefined || p === null) | ||
? isUrl(paths[0]) ? '/' : path.sep | ||
: p; | ||
} | ||
} |
{ | ||
"name": "join-path", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Join urls or system paths, even with undefined values", | ||
@@ -26,7 +26,7 @@ "main": "index.js", | ||
"devDependencies": { | ||
"tap-spec": "^1.0.0", | ||
"tape": "^3.0.0" | ||
"tap-spec": "^4.0.2", | ||
"tape": "^4.0.0" | ||
}, | ||
"dependencies": { | ||
"as-array": "^0.1.2", | ||
"as-array": "^1.0.0", | ||
"is-url": "^1.1.0", | ||
@@ -33,0 +33,0 @@ "url-join": "0.0.1" |
13
test.js
@@ -1,10 +0,11 @@ | ||
var join = require('./index.js'); | ||
var test = require('tape'); | ||
var join = require('./index.js'); | ||
test('joins a system path', function (t) { | ||
t.equal(join('some', 'path'), 'some/path', 'basic path'); | ||
t.equal(join('/', 'some', 'path'), '/some/path', 'path with leading slash'); | ||
t.equal(join('some', undefined, 'path'), 'some/path', 'path with undefined value'); | ||
t.end(); | ||
@@ -14,3 +15,3 @@ }); | ||
test('joins a url', function (t) { | ||
t.equal(join('http://test.com/', '/about'), 'http://test.com/about', 'basic url'); | ||
@@ -20,4 +21,4 @@ t.equal(join('http://', 'test.com', '/some/path'), 'http://test.com/some/path', 'http:// leading protocol only'); | ||
t.equal(join('ftp://', 'test.com', '/some/path'), 'ftp://test.com/some/path', 'ftp:// leading protocol only'); | ||
t.end(); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36
4285
+ Addedas-array@1.0.0(transitive)
+ Addedlodash._isnative@2.4.1(transitive)
+ Addedlodash._objecttypes@2.4.1(transitive)
+ Addedlodash._shimkeys@2.4.1(transitive)
+ Addedlodash.isobject@2.4.1(transitive)
+ Addedlodash.keys@2.4.1(transitive)
+ Addedlodash.values@2.4.1(transitive)
- Removedas-array@0.1.2(transitive)
Updatedas-array@^1.0.0