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

urlconcat

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

urlconcat - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

.travis.yml

10

package.json
{
"name": "urlconcat",
"version": "0.0.4",
"version": "0.0.5",
"description": "Concats paths in an url, places slashes where necessary.",

@@ -8,3 +8,3 @@ "main": "urlconcat.js",

"test": "jshint urlconcat.js & node ./test/urlconcatTest.js",
"release": "uglifyjs urlconcat.js > urlconcat.min.js & npm-release patch"
"release": "uglifyjs urlconcat.js > urlconcat.min.js & npm-release patch -m Release [ci skip]"
},

@@ -29,7 +29,7 @@ "repository": {

"buster": "^0.7.18",
"jshint": "^2.6.3",
"npm-release": "0.0.4-3",
"uglify-js": "^2.4.16"
"jshint": "^2.9.4",
"npm-release": "1.0.0",
"uglify-js": "^2.7.4"
},
"dependencies": {}
}

@@ -12,2 +12,3 @@ # urlconcat

### CommonJS
```javascript

@@ -17,1 +18,16 @@ var urlconcat = require('urlconcat');

```
### ES2015
```javascript
import urlconcat from 'urlconcat';
urlconcat.concat('http://localhost:8080/', 'search', 'something'); // 'http://localhost:8080/search/something'
```
or
```javascript
import { concat } from 'urlconcat';
concat('http://localhost:8080/', 'search', 'something'); // 'http://localhost:8080/search/something'
```
(function() {
'use strict';
var trailingSlashIfNecessary = function(url) {
return url.substr(-1) !== '/' ? url + '/' : url;
var trailingSlashIfNecessary = function(urlPart, nextUrlPart) {
if (nextUrlPart.substr(0, 1) === '?') {
return urlPart;
}
return urlPart.substr(-1) !== '/' ? urlPart + '/' : urlPart;
};

@@ -12,5 +15,6 @@

for (var i = 0; i < args.length - 1; i++) {
concatted += trailingSlashIfNecessary(args[i]);
concatted += trailingSlashIfNecessary(args[i], args[i+1]);
}
return concatted += args[args.length - 1];
concatted += args[args.length - 1];
return concatted.replace(/([^:]\/)\/+/g, "$1");
};

@@ -17,0 +21,0 @@

@@ -1,1 +0,1 @@

(function(){"use strict";var trailingSlashIfNecessary=function(url){return url.substr(-1)!=="/"?url+"/":url};var urlconcat=function(){var args=arguments;var concatted="";for(var i=0;i<args.length-1;i++){concatted+=trailingSlashIfNecessary(args[i])}return concatted+=args[args.length-1]};if(typeof define==="function"&&define.amd){define(function(){return{concat:urlconcat}})}else if(typeof module!=="undefined"&&module.exports){module.exports.concat=urlconcat}else{this.urlconcat=urlconcat}}).call(this);
(function(){"use strict";var trailingSlashIfNecessary=function(urlPart,nextUrlPart){if(nextUrlPart.substr(0,1)==="?"){return urlPart}return urlPart.substr(-1)!=="/"?urlPart+"/":urlPart};var urlconcat=function(){var args=arguments;var concatted="";for(var i=0;i<args.length-1;i++){concatted+=trailingSlashIfNecessary(args[i],args[i+1])}concatted+=args[args.length-1];return concatted.replace(/([^:]\/)\/+/g,"$1")};if(typeof define==="function"&&define.amd){define(function(){return{concat:urlconcat}})}else if(typeof module!=="undefined"&&module.exports){module.exports.concat=urlconcat}else{this.urlconcat=urlconcat}}).call(this);
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