
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
js-utils-url
Advanced tools
js-utils-url
仅依赖JS Engine运行环境的URL 解析、修改/追回参数hash等方法集
$ yarn add js-utils-url
import {
parse,
setSearch
} from 'js-utils-url';
const r = parse('/pages/foo/index?&a=1&b=2&c=3#hash');
//return
r = {
"href": "/pages/foo/index?&a=1&b=2&c=3#hash",
"origin": "",
"pathname": "/pages/foo/index",
"search": "?&a=1&b=2&c=3",
"hash": "#hash",
"params": {
"a": "1",
"b": "2",
"c": "3"
}
}
parse('https://m.foo.com/foo/index.html?&a=1&b=2&c=3#hash');
//return
{
"href": "https://m.foo.com/foo/index.html?&a=1&b=2&c=3#hash",
"origin": "https://m.foo.com",
"protocol": "https:",
"host": "m.foo.com",
"hostname": "m.foo.com",
"pathname": "/foo/index.html",
"port": undefined,
"search": "?&a=1&b=2&c=3",
"hash": "#hash",
"params": {
"a": "1",
"b": "2",
"c": "3"
}
}
//修改或追加参数
setSearch('/pages/foo/index?&a=1&b=2&c=3#hash', {a:7, e:9}, 'newHash');
//return
"/pages/foo/index?a=7&b=2&c=3&e=9#newHash"
setSearch('https://m.foo.com/pages/foo/index?&a=1&b=2&c=3#hash', {a:7, e:9}, 'newHash');
//return
"https://m.foo.com/pages/foo/index?a=7&b=2&c=3&e=9#newHash"
npm run dev
npm run build
npm run pub
npm run beta
FAQs
> 仅依赖JS Engine运行环境的URL 解析、修改/追回参数hash等方法集
The npm package js-utils-url receives a total of 0 weekly downloads. As such, js-utils-url popularity was classified as not popular.
We found that js-utils-url demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.