UNPKG

@xapp/dynamo-service

Version:

A dynamo help class which will help maintain data integrity.

13 lines (12 loc) 1.2 kB
import { StringKeys } from "../types/StringKeys"; export declare function objHasAttrs(obj: object): boolean; export type ValidationErrorHandler = (keys: string[], error: Error) => void; export declare function throwIfDoesContain(obj: object, bannedAttrs: string[], onError?: ValidationErrorHandler): void; export declare function throwIfDoesContain(obj: string[], bannedAttrs: string[], onError?: ValidationErrorHandler): void; export declare function throwIfDoesNotContain<T extends object>(obj: T, requiredAttrs: (StringKeys<T>)[], undefinedPermitted?: boolean, onError?: ValidationErrorHandler): void; export declare function throwIfContainsExtra<T extends object>(obj: T, restrictAttrs: (keyof T)[], undefinedPermitted?: boolean, onError?: ValidationErrorHandler): void; export declare function subset<T extends object>(obj: T, attrs: string[]): Partial<T>; export declare function subset(obj: string[], attrs: string[]): string[]; export type ValidateKeyCallback = (key: string | number, value: any) => boolean; export declare function removeItems<T extends object>(obj: Partial<T>, attrs: (keyof T)[]): Partial<T>; export declare function removeItems(obj: string[], attrs: string[]): string[];