js-utils-url
Advanced tools
Comparing version 1.0.3 to 1.0.6
@@ -0,1 +1,5 @@ | ||
## [1.0.5](https://github.com/lamovv/js-utils-url/compare/v1.0.3...v1.0.5) (2020-10-26) | ||
# 1.0.0 (2020-04-16) | ||
@@ -2,0 +6,0 @@ |
@@ -5,3 +5,3 @@ 'use strict'; | ||
var v = '1.0.2'; | ||
var v = '1.0.5'; | ||
/** | ||
@@ -119,6 +119,31 @@ * @typedef {object} Url | ||
} | ||
/** | ||
* @param {string} search | ||
* @returns {object} | ||
*/ | ||
function search2JSON(search) { | ||
var queryArr = search.replace(/^\?/, '').split(/&+/); | ||
var params; | ||
queryArr.forEach(function (item) { | ||
//防止value里包含'='误伤 | ||
var index = item.indexOf('='); | ||
var key = item.substr(0, index); | ||
var value = item.substring(index + 1); | ||
if (key) { | ||
if (!params) { | ||
params = {}; | ||
} | ||
params[key] = decodeURIComponent(value); | ||
} | ||
}); | ||
return params; | ||
} | ||
exports.object2search = object2search; | ||
exports.parse = parse; | ||
exports.search2JSON = search2JSON; | ||
exports.setSearch = setSearch; | ||
exports.v = v; |
@@ -31,17 +31,22 @@ /** | ||
export function setSearch(url: string, params: any, newHash: string): string; | ||
export const v: '__VERSION__'; | ||
/** | ||
* @param {string} search | ||
* @returns {object} | ||
*/ | ||
export function search2JSON(search: string): any; | ||
export const v: "__VERSION__"; | ||
export type Url = { | ||
/** | ||
* - 源url | ||
*/ | ||
href: string; | ||
origin: string; | ||
protocol: string; | ||
host: string; | ||
hostname: string; | ||
port: number; | ||
pathname: string; | ||
search: string; | ||
hash: string; | ||
params: any; | ||
/** | ||
* - 源url | ||
*/ | ||
href: string; | ||
origin: string; | ||
protocol: string; | ||
host: string; | ||
hostname: string; | ||
port: number; | ||
pathname: string; | ||
search: string; | ||
hash: string; | ||
params: any; | ||
}; |
@@ -1,2 +0,2 @@ | ||
var v = '1.0.2'; | ||
var v = '1.0.5'; | ||
/** | ||
@@ -114,3 +114,27 @@ * @typedef {object} Url | ||
} | ||
/** | ||
* @param {string} search | ||
* @returns {object} | ||
*/ | ||
export { object2search, parse, setSearch, v }; | ||
function search2JSON(search) { | ||
var queryArr = search.replace(/^\?/, '').split(/&+/); | ||
var params; | ||
queryArr.forEach(function (item) { | ||
//防止value里包含'='误伤 | ||
var index = item.indexOf('='); | ||
var key = item.substr(0, index); | ||
var value = item.substring(index + 1); | ||
if (key) { | ||
if (!params) { | ||
params = {}; | ||
} | ||
params[key] = decodeURIComponent(value); | ||
} | ||
}); | ||
return params; | ||
} | ||
export { object2search, parse, search2JSON, setSearch, v }; |
{ | ||
"name": "js-utils-url", | ||
"version": "1.0.3", | ||
"version": "1.0.6", | ||
"description": "> 仅依赖JS Engine运行环境的URL 解析、修改/追回参数hash等方法集", | ||
@@ -77,7 +77,7 @@ "keywords": [ | ||
"init:nolock": "npm run clean && rm -rf node_modules && yarn install -s --force --no-lockfile", | ||
"build": "run-p build:es build:types", | ||
"build": "run-p prettier build:es build:types", | ||
"build:es": "rm -rf dist && rollup -c --silent", | ||
"build:umd": "cross-env NODE_FORMAT=umd rollup -c --silent", | ||
"build:all": "run-p build build:umd", | ||
"build:types": "tsc --declaration --emitDeclarationOnly --outDir dist && prettier \"dist/*.d.ts\" --write", | ||
"build:types": "tsc", | ||
"build:wpk": "cross-env NODE_ENV=production webpack --mode=production", | ||
@@ -84,0 +84,0 @@ "clean": "rm -rf dist", |
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
13626
297