Skip to content

Commit 39c3a9f

Browse files
author
devgioele
committed
add null as a valid query value
1 parent caea622 commit 39c3a9f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/engine/query.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export type AbstractQueryValueElement =
88
| boolean
99
| Date
1010
| bigint
11+
| null
1112

1213
export type AbstractQuery = Record<
1314
string,
@@ -54,7 +55,7 @@ export type AbstractQueryOptions = {
5455
/**
5556
* How the abstract query is converted to an actual query.
5657
*
57-
* @default Each value that is not undefined is converted to a string by calling `.toString()`.
58+
* @default Each value that is not undefined and is converted to a string. `null` is converted to an empty string, while other values are converted calling `String(value)`.
5859
*/
5960
convertToQuery: (abstractQuery: Partial<AbstractQuery>) => Query
6061
}
@@ -64,7 +65,7 @@ const DEFAULT_ABSTRACT_QUERY_OPTIONS: AbstractQueryOptions = {
6465
const query: Query = {}
6566
for (const [key, value] of Object.entries(abstractQuery)) {
6667
if (value !== undefined) {
67-
query[key] = value.toString()
68+
query[key] = value === null ? '' : String(value)
6869
}
6970
}
7071
return query

0 commit comments

Comments
 (0)