Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/videsk/params-parser
Add query parameters to an URL dynamically by object, array o single parameter, specially for Rest API.
https://github.com/videsk/params-parser
params query rest-api videsk
Last synced: about 1 month ago
JSON representation
Add query parameters to an URL dynamically by object, array o single parameter, specially for Rest API.
- Host: GitHub
- URL: https://github.com/videsk/params-parser
- Owner: videsk
- License: apache-2.0
- Created: 2019-10-04T04:57:17.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-29T20:48:29.000Z (over 4 years ago)
- Last Synced: 2024-09-20T09:22:04.383Z (5 months ago)
- Topics: params, query, rest-api, videsk
- Language: JavaScript
- Homepage: https://open.videsk.io
- Size: 61.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# Params Parser
This library allow to generate a url with params added by object, array or by units.
## How to use
For start only need initialize class.
```js
const paramParse = new ParamsParse();
```## Add params by one
```js
paramParse.add()
```## Add params by object
```js
paramParse.byObj({ name: 'John', number: 9236376288 });
```## Add params by array
```js
paramParse.byArray('channels[$in]', ['5c82cb15582685351224cce3', '5c82cb25582685351224cce4'])
```## Get the URL
For get the URL with parameters only need execute:
```js
paramParse.parse();// Output
'?name=John&number=9236376288&channels[$in]=5c82cb15582685351224cce3&channels[$in]=5c82cb25582685351224cce4';
```## Copyrights
This library is totally open source with Apache 2.0 license, but was designed for Videsk™ products.