UNPKG

gremlin-helper

Version:

A wrapper around the gremlin client to introduce model validation and other useful functionality to use within a web api.

17 lines (16 loc) 522 B
import { IPropDef } from './Schema'; export interface IOpResult<T> { error: string | null; value: T | null; } export declare type Op<T> = (prop: IPropDef, value: T) => Promise<IOpResult<T>>; export declare type ModelOps<T> = { [P in keyof T]?: Op<T[P]>; }; export declare class Ops { static merge: <T>(...ops: Op<T>[]) => Op<T>; static trim: Op<string>; static formatPhone: Op<string>; static validatePhone: Op<string>; static hashPassword: (saltOrRounds: string | number) => Op<string>; }