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

query-path

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

query-path - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

32

index.js
'use strict';
var _ = require('lodash');
var compact = function(array) {
var index = -1,
length = array ? array.length : 0,
resIndex = -1,
result = [];
while (++index < length) {
var value = array[index];
if (value) {
result[++resIndex] = value;
}
}
return result;
}
exports.queryStringByKey = function(key, url) {

@@ -20,5 +35,5 @@ key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");

} else {
pathname = (typeof window !== "undefined")?window.location.pathname:'';
pathname = (typeof window !== "undefined") ? window.location.pathname : '';
}
pathname = _.compact(pathname.split('/'));
pathname = compact(pathname.split('/'));
if (index < pathname.length) {

@@ -36,11 +51,12 @@ retVal = pathname[index];

} else {
pathname = (typeof window !== "undefined")?window.location.pathname:'';
pathname = (typeof window !== "undefined") ? window.location.pathname : '';
}
pathname = _.compact(pathname.split('/'));
if (matchingString && !_.isEmpty(pathname)) {
_.each(pathname, function(val, i) {
pathname = compact(pathname.split('/'));
console.info('pathname', pathname);
if (matchingString && pathname.length > 0) {
pathname.map(function(val, i) {
if (val.indexOf(matchingString) >= 0) {
retVal.push(val);
}
});
})
}

@@ -47,0 +63,0 @@

{
"name": "query-path",
"version": "1.0.7",
"version": "1.0.8",
"description": "helper methods to work with URL query string and pathname",

@@ -30,5 +30,4 @@ "license": "MIT",

"dependencies": {
"lodash": "^3.10.1"
},
"devDependencies": {}
}
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