@brizy/ui
Version:
React elements in Brizy style
27 lines (26 loc) • 1.23 kB
TypeScript
import { MVal } from "./MVal";
/**
* Check whenever an potential maybe value is empty or not
*/
export declare const isT: <T>(t: MVal<T>) => t is T;
/**
* Check whenever a list of values has undefined values or not
*/
export declare const isTs: <T>(ts: MVal<T>[]) => ts is T[];
/**
* Test a value by given predicate,
* If the value passes the predicate, return value,
* otherwise, return undefined
*/
export declare function pass<A, B extends A>(predicate: (a: A) => a is B): (t: A) => B | undefined;
export declare function pass<A>(predicate: (a: A) => boolean): (t: A) => A | undefined;
export declare const _pass: <T>(predicate: (t: T) => boolean) => (t: T) => T | undefined;
/**
* Test a value if is of specific type given type guard predicate,
* If the value passes the predicate, return value,
* otherwise, return undefined
*/
export declare const passT: <A, B extends A>(guard: (a: A) => a is B) => (a: A) => B | undefined;
export declare const isRecord: <R extends Record<any, any>>(v: { [k in keyof R]: MVal<R[k]>; }) => v is R;
export declare function errorOnEmpty(m: string): <T>(t: MVal<T>) => T;
export declare const mEq: <T>(predicate: (a: T, b: T) => boolean) => (a: MVal<T>, b: MVal<T>) => boolean;