json-p3
Version:
JSONPath, JSON Pointer and JSON Patch
45 lines (44 loc) • 1.55 kB
TypeScript
import { FilterFunction, FunctionExpressionType } from "./function";
export type HasFilterFunctionOptions = {
/**
* The maximum number of regular expressions to cache. Defaults
* to 10.
*/
cacheSize?: number;
/**
* If _true_, throw errors from regex construction and matching.
* The standard and default behavior is to ignore these errors
* and return _false_.
*/
throwErrors?: boolean;
/**
* If _true_, check that regexp patterns are valid according to I-Regexp.
* The standard and default behavior is to silently return _false_ if a
* pattern is invalid.
*
* If `iRegexpCheck` is _true_ and `throwErrors` is _true_, an `IRegexpError`
* will be thrown.
*/
iRegexpCheck?: boolean;
/**
* if _true_, use regex search semantics when testing patterns against
* property names. Defaults to _true_.
*/
search?: boolean;
};
/**
* A function extension that returns `true` if the first argument is an object
* value and it contains a property matching the second argument.
*/
export declare class Has implements FilterFunction {
#private;
readonly options: HasFilterFunctionOptions;
readonly argTypes: FunctionExpressionType[];
readonly returnType = FunctionExpressionType.LogicalType;
readonly cacheSize: number;
readonly throwErrors: boolean;
readonly iRegexpCheck: boolean;
readonly search: boolean;
constructor(options?: HasFilterFunctionOptions);
call(value: unknown, pattern: string): boolean;
}