rule-filter-validator
Version:
A object and scope validator based on structured rules
15 lines (14 loc) • 637 B
TypeScript
import type { Filter } from './types';
/**
* Validate the payload against the given filter rules
*
* @param {Filter} filter - The filter rules to check against
* @param {Record<string, any>} payload - The payload to validate
* @param {boolean} strict(false) - Type and Case-sensitive validation
* @returns Array<string> errors if any
*/
export declare function validatePayload(filter: Filter, payload: Record<string, any>, strict?: boolean): string[];
/**
* A shorthand function to check if the payload is valid
*/
export declare function isValidPayload(filter: Filter, payload: Record<string, any>, strict?: boolean): boolean;