Get rid of lots of unnecessary lodash calls.
This commit is contained in:
parent
b734a422a7
commit
5592892f0d
16 changed files with 99 additions and 115 deletions
server/types
|
@ -116,6 +116,10 @@ export function toIsEnum<E>(enumDef: E): EnumTypeGuard<E> {
|
|||
return (arg): arg is EnumValue<E> => Object.values(enumDef).includes(arg as [keyof E]);
|
||||
}
|
||||
|
||||
export function isRegExp(arg: unknown): arg is RegExp {
|
||||
return isObject(arg) && arg instanceof RegExp;
|
||||
}
|
||||
|
||||
export function isOptional<T>(arg: unknown, isT: TypeGuard<T>): arg is (T | undefined) {
|
||||
return arg === undefined || isT(arg);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue