@thisisagile/easy
Version:
Straightforward library for building domain-driven microservice architectures
34 lines (33 loc) • 1.3 kB
TypeScript
import { Get, Predicate } from './Get';
import { Constructor } from './Constructor';
export declare class Parser<T, V> {
protected value: T;
protected valid: boolean;
if: {
equals: (pred?: Predicate<T>) => this;
empty: <U>(pred?: Get<U, T>) => this;
defined: <U>(pred?: Get<U, T>) => this;
valid: <U>(pred?: Get<U, T>) => this;
in: (...items: T[]) => this;
is: {
object: <U>(pred?: Get<U, T>) => this;
string: <U>(pred?: Get<U, T>) => this;
instance: <U>(c: Constructor<U>, pred?: Get<U, T>) => this;
};
not: {
empty: <U>(pred?: Get<U, T>) => this;
defined: <U>(pred?: Get<U, T>) => this;
valid: <U>(pred?: Get<U, T>) => this;
isObject: <U>(pred?: Get<U, T>) => this;
in: (...items: T[]) => this;
is: {
object: <U>(pred?: Get<U, T>) => this;
string: <U>(pred?: Get<U, T>) => this;
instance: <U>(c: Constructor<U>, pred?: Get<U, T>) => this;
};
};
};
constructor(value: T, valid?: boolean);
protected evaluate<U>(meta: Get<boolean>, pred?: Get<U, T>): this;
protected evaluateNot<U>(meta: Get<boolean>, pred?: Get<U, T>): this;
}