Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/afeiship/next-url-operator
Operator for url.
https://github.com/afeiship/next-url-operator
browser hash hashlize next operator params query querystring url wip
Last synced: 12 days ago
JSON representation
Operator for url.
- Host: GitHub
- URL: https://github.com/afeiship/next-url-operator
- Owner: afeiship
- License: mit
- Created: 2021-04-28T00:23:11.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-06-30T03:12:30.000Z (over 1 year ago)
- Last Synced: 2024-10-28T04:59:56.668Z (about 2 months ago)
- Topics: browser, hash, hashlize, next, operator, params, query, querystring, url, wip
- Language: JavaScript
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# next-url-operator
> Operator for url.[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]## installation
```bash
npm install -S @jswork/next-url-operator
```## apis
| api | params | description |
| -------------- | --------------------------- | ---------------------------------- |
| get | (name: string) | Get param by name. |
| gets | - | Get all parmas. |
| set | (name:string, value:string) | Set param value |
| sets | (object:any) | Update params value. |
| update(public) | (object):string | Update params and get the new url. |
| url(public) | location.href | The current url. |## usage
```js
import NxUrlOperator from '@jswork/next-url-operator';const op = new NxUrlOperator({ url: 'https://www.baidu.com?q=hello' });
const url = op.update({ q: 'world'});//https://www.baidu.com?q=world
// static method
NxUrlOperator.update({
q: 'hello'
});// http://locahost?q=hello
```## license
Code released under [the MIT license](https://github.com/afeiship/next-url-operator/blob/master/LICENSE.txt).[version-image]: https://img.shields.io/npm/v/@jswork/next-url-operator
[version-url]: https://npmjs.org/package/@jswork/next-url-operator[license-image]: https://img.shields.io/npm/l/@jswork/next-url-operator
[license-url]: https://github.com/afeiship/next-url-operator/blob/master/LICENSE.txt[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/next-url-operator
[size-url]: https://github.com/afeiship/next-url-operator/blob/master/dist/next-url-operator.min.js[download-image]: https://img.shields.io/npm/dm/@jswork/next-url-operator
[download-url]: https://www.npmjs.com/package/@jswork/next-url-operator