@yo8568/query-stringify
v1.0.0
Published
A query stringify tool
Downloads
1
Readme
Query Stringify
A simple tool for combining some query parameters as a entire url string.
Installation
$ npm install @yo8568/query-stringify
Usage
parameters
qs({ basePath, query, url, ignore })
@param {string} options.basePath - url
@param {object} options.query - parameters, eg query = { limit: 20, accounts: ['123', '456'], breakdown: 'country' }
@param {string} options.url - next page url [high priority]
@param {array} options.ignore - ignore specfic fields
import qs from 'query-stringify'
qs({
basePath: '/api/test',
query: {
user: [1234, 3456],
business: '3333333',
skip: 10,
limit: 333
},
ignore: ['user']
})
// output: '/api/test?business=3333333&skip=10&limit=333'
Run Test
Test
$ npm run test
Converage
$ npm run cov
Licence
MIT