Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

join-path

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

join-path - npm Package Compare versions

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"

@@ -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();
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc