Options
All
  • Public
  • Public/Protected
  • All
Menu

Class JsonRules

With JsonRules you can validate objects with given rules.

export
class

JsonRules

Hierarchy

  • JsonRules

Index

Constructors

constructor

Methods

IsValid

  • IsValid(source: any, ruleSet: RuleSet): boolean
  • IsValid validates the given rule set against the source object.

    If there are selectors definded which does not

    memberof

    JsonRules

    Parameters

    • source: any

      Object to test.

    • ruleSet: RuleSet

      The rules to validate.

    Returns boolean

    Ture if the source matches the rules, otherwise false.

RuleMatches

  • RuleMatches(values: any, rule: any): boolean
  • Checks if the rule matches.

    memberof

    JsonRules

    Parameters

    • values: any

      Values to check.

    • rule: any

      Rule to validate

    Returns boolean

    True if the rule matches, otherwise false

SelectorMatches

  • SelectorMatches(values: any, rule: any): boolean
  • Checks if the selector matches.

    memberof

    JsonRules

    Parameters

    • values: any

      Values to check.

    • rule: any

      Selector to validate

    Returns boolean

    True if the selector matches, otherwise false

ShouldValidateRule

  • ShouldValidateRule(source: any, ruleSet: RuleSet): boolean
  • Returns true if no selector is defined or all of the given selectors matches with the source object. Otherwise false.

    memberof

    JsonRules

    Parameters

    • source: any

      Object to test.

    • ruleSet: RuleSet

      The rules to validate.

    Returns boolean

    True if the rule should be used, otherwise false.

Generated using TypeDoc