11 lines
301 B
TypeScript
11 lines
301 B
TypeScript
export const nullish = <T>(
|
|
value: T | null | undefined,
|
|
): value is null | undefined => {
|
|
return value === null || value === undefined;
|
|
};
|
|
|
|
export const notNullish = <T>(value: T | null | undefined): value is T =>
|
|
value !== null && value !== undefined;
|
|
|
|
export const idRegex = /^[a-zA-Z0-9_-]+$/;
|