get-param-by-name
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -1,2 +0,4 @@ | ||
export default function (search) { | ||
"use strict"; | ||
var getParamByName = function getParamByName(search) { | ||
var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.href; | ||
@@ -9,2 +11,10 @@ var name = search.replace(/[\[\]]/g, '\\$&'); | ||
return decodeURIComponent(results[2].replace(/\+/g, ' ')); | ||
}; | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = getParamByName; | ||
} else if (typeof define === 'function' && define.amd) { | ||
define('getParamByName', [], function (require, exports, module) { | ||
return getParamByName; | ||
}); | ||
} |
{ | ||
"name": "get-param-by-name", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A JavaScript utility for retrieving a parameter value by name from a URL.", | ||
@@ -27,8 +27,11 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@babel/cli": "^7.1.2", | ||
"@babel/core": "^7.1.2", | ||
"@babel/cli": "^7.1.5", | ||
"@babel/core": "^7.1.6", | ||
"@babel/preset-env": "^7.1.6", | ||
"babel-jest": "^23.6.0", | ||
"babel-preset-env": "^1.7.0", | ||
"jest": "^23.6.0" | ||
}, | ||
"resolutions": { | ||
"@babel/core": "7.0.0-bridge.0" | ||
}, | ||
"jest": { | ||
@@ -35,0 +38,0 @@ "moduleFileExtensions": [ |
# get-param-by-name | ||
![npm](https://img.shields.io/npm/v/get-param-by-name.svg) | ||
[![npm](https://img.shields.io/npm/v/get-param-by-name.svg)](https://www.npmjs.com/package/get-param-by-name) | ||
![CircleCI (all branches)](https://img.shields.io/circleci/project/github/mhfen/get-param-by-name/master.svg) | ||
@@ -36,3 +36,3 @@ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) | ||
```bash | ||
$ npm install | ||
$ yarn | ||
``` | ||
@@ -43,3 +43,3 @@ | ||
```bash | ||
$ npm test | ||
$ yarn test | ||
``` | ||
@@ -50,3 +50,3 @@ | ||
```bash | ||
$ npm run build | ||
$ yarn build | ||
``` |
@@ -1,2 +0,2 @@ | ||
export default function(search, url = window.location.href) { | ||
const getParamByName = function(search, url = window.location.href) { | ||
const name = search.replace(/[\[\]]/g, '\\$&'); | ||
@@ -10,2 +10,10 @@ const regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'); | ||
return decodeURIComponent(results[2].replace(/\+/g, ' ')); | ||
}; | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = getParamByName; | ||
} else if (typeof define === 'function' && define.amd) { | ||
define('getParamByName', [], function(require, exports, module) { | ||
return getParamByName; | ||
}); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
188835
10
61