qs-native
Lightweight querystring parse & stringify based on URLSearchParams API
npm install qs-native
Using
import qs from 'qs-native';
qs.parse("?a=b&c=d");
qs.stringify({ a: "b", c: "d" });
Parsing options
strictNullHandling: boolean - optional
qs.parse("?a=b&c");
Stringify options
skipNulls: boolean - optional
qs.stringify({ a: "b", c: null }, { skipNulls: true });
addQueryPrefix: boolean - optional
qs.stringify({ a: "b", c: "d" }, { addQueryPrefix: true });
Using in IE11 and older
For using qs-native in IE11 and other browsers that doesn't support URLSearchParams API install core-js
polyfill https://github.com/zloirock/core-js#url-and-urlsearchparams
CoreJS - CommonJS entry points:
core-js/proposals/url
core-js(-pure)/web/url
core-js(-pure)/web/url-search-params
core-js(-pure)/stable|features/url
core-js/stable|features/url/to-json
core-js(-pure)/stable|features/url-search-params