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.2 to 1.0.3

42

index.js
'use strict';
exports.qsval = function(name, url) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)");
var _ = require('lodash');
exports.queryStringByKey = function(key, url) {
key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + key + "=([^&#]*)");
if (url) {

@@ -12,1 +13,36 @@ var results = regex.exec(url);

}
exports.pathByIndex = function(index, url) {
var pathname = '';
var retVal = '';
if (url) {
pathname = url;
} else {
pathname = window.location.pathname;
}
pathname = _.compact(pathname.split('/'));
if (index < pathname.length) {
retVal = pathname[index];
}
return retVal;
}
exports.pathByMatchingString = function(matchingString, url) {
var pathname = '';
var retVal = [];
if (url) {
pathname = url;
} else {
pathname = window.location.pathname;
}
pathname = _.compact(pathname.split('/'));
if (matchingString && !_.isEmpty(pathname) {
_.each(pathname, function(val, i) {
if (val.indexOf(matchingString) >= 0) {
retVal.push[val];
}
});
}
return retVal;
}

2

package.json
{
"name": "query-path",
"version": "1.0.2",
"version": "1.0.3",
"description": "helper methods to work with URL query string and pathname",

@@ -5,0 +5,0 @@ "license": "MIT",

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