Releases: pbeshai/serialize-query-params
v1.3.1
v1.3.0
v1.2.4
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.1.0
v1.0.0
-
breaking Changes the way empty string/null/undefined values are handled #20. Now null and empty strings are kept. Invalid values will either be null or NaN depending on type (previously became undefined). This allows more direct mapping of query parameter values to what we get in the code and the following cases:
?foo
?foo=
. -
Adds a
withDefault()
function #21 that wraps parameters to provide a default value with correct types. e.g. if you want the old behavior where null becomes undefined, you can dowithDefault(ArrayParam, undefined)
or if you just want to set the default value of a parameter, you set it as the second argument.withDefault(ArrayParam, [])
. If you do not want nulls to be considered as undefined for the purposes of populating a default value, pass false as the third argument.