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

combo-url-parser

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

combo-url-parser - npm Package Compare versions

Comparing version 0.0.2 to 0.1.0

.npmignore

4

index.js

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

module.exports = require('./lib/parser.js');
var parser = module.exports = require('./lib/parser.js');
parser.middleware = require('./lib/middleware');

@@ -0,31 +1,36 @@

var URL = require("url");
function join(a, b) {
if (a && b) {
a = a.replace(/\/?$/, '/');
b = b.replace(/^\/?/, '');
}
return a + b;
}
module.exports = function(url){
var base = '',
paths = [],
parts,
idx1,
originurl = url,
idx2;
var lead = '??';
var sep = ',';
//remove the query
idx1 = url.indexOf('??');
idx2 = url.indexOf('?');
//get real query
if (idx1 > -1 && (idx1 <= idx2)) {
base = url.substring(0, idx1);
url = url.substring(idx1 + 2);
idx2 = url.indexOf('?');
var idx1 = url.indexOf(lead);
if (idx1 === -1) {
return [url];
}
var base = url.substring(0, idx1);
var ext = URL.parse(url.substring(idx1 + lead.length));
return ext.pathname.split(sep).map(function(subPath){
if (idx2 > -1) {
url = url.substring(0, idx2);
}
paths = url.split(',');
paths = paths.map(function(val){
var path = base + '/' + val;
return path.replace(/\/+/g, '/');
return URL.format({
search: ext.search,
pathname: join(base, subPath)
});
});
return paths;
};

@@ -5,3 +5,3 @@ {

"description": "A util to parser comboed url",
"version": "0.0.2",
"version": "0.1.0",
"repository": {

@@ -12,3 +12,3 @@ "type": "git",

"scripts": {
"test": "jasmine-node ."
"test": "./node_modules/.bin/mocha"
},

@@ -18,4 +18,9 @@ "engines": {

},
"dependencies": {},
"devDependencies": {}
"dependencies": {
"combined-stream": "0.0.4",
"request": "~2.34.0"
},
"devDependencies": {
"mocha": "~1.18.0"
}
}

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

[![build status](https://secure.travis-ci.org/maxbbn/combo-url-parser.png)](http://travis-ci.org/maxbbn/combo-url-parser)
util to parse comboed url;

@@ -2,0 +3,0 @@

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