refactor: add overloading for util function
This commit is contained in:
parent
c9ee4c1a98
commit
652cba9cfe
1 changed files with 4 additions and 2 deletions
|
|
@ -28,6 +28,8 @@ export function whereAddressQuery(query: string) {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function queryOrNot<T>(query: string | boolean, where: T): T | undefined {
|
export function queryOrNot<T>(query: string | boolean, where: T): T | undefined;
|
||||||
return !!query ? where : undefined;
|
export function queryOrNot<T, U>(query: string | boolean, where: T, fallback: U): T | U;
|
||||||
|
export function queryOrNot<T, U>(query: string | boolean, where: T, fallback?: U) {
|
||||||
|
return !!query ? where : fallback;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue