@ivandt/json-rules
Version:
Rule parsing engine for JSON rules
40 lines (39 loc) • 1.37 kB
TypeScript
import { Rule, Condition, Constraint, WithRequired, ConditionType } from "../types";
export declare class ObjectDiscovery {
/**
* Returns the type of condition passed to the function.
* @param condition The condition to check.
*/
conditionType(condition: Condition): ConditionType | null;
/**
* Checks the rule to see if it is granular.
* @param rule The rule to check.
*/
isGranular(rule: Rule): boolean;
/**
* Checks an object to see if it is a valid condition.
* @param obj The object to check.
*/
isCondition(obj: unknown): obj is Condition;
/**
* Checks an object to see if it is a valid sub-rule.
* @param obj The object to check.
*/
isConditionWithResult(obj: unknown): obj is WithRequired<Condition, "result">;
/**
* Checks an object to see if it is a valid constraint.
* @param obj The object to check.
*/
isConstraint(obj: unknown): obj is Constraint;
/**
* Returns true if the passed parameter is an object.
* @param obj The item to test.
*/
isObject(obj: unknown): obj is object;
/**
* Resolves a nested property from a sting as an object path.
* @param path The path to resolve.
* @param obj The object to resolve the path against.
*/
resolveNestedProperty(path: string, obj: object): any;
}