From c23bbb75d14f359615b1357a289049b3e17c575f Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 18 Aug 2018 19:19:41 +0300 Subject: [PATCH] more docs... Signed-off-by: Alex A. Naanou --- README.md | 46 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 405bd2d..1cb651a 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ - [Applying changes (*patch*)](#applying-changes-patch) - [Partial patching](#partial-patching) - [Checking](#checking) - - [Patterns](#patterns) + - [Generic ways to compare objects (*patterns*)](#generic-ways-to-compare-objects-patterns) - [Motivation](#motivation) - [Goals / Features](#goals--features) - [Installation and loading](#installation-and-loading) @@ -20,6 +20,9 @@ - [Options](#options) - [Deep compare](#deep-compare) - [Patterns](#patterns) + - [Logic patterns](#logic-patterns) + - [String patterns](#string-patterns) + - [Number patterns](#number-patterns) - [Patterns (EXPERIMENTAL)](#patterns-experimental) - [JSON compatibility](#json-compatibility) - [Extending Diff](#extending-diff) @@ -143,7 +146,7 @@ XXX modify the diff -- teach Ted guitar... XXX -### Patterns +### Generic ways to compare objects (*patterns*) And for further checking we can create a *pattern*: ```javascript @@ -313,24 +316,61 @@ XXX XXX General description... +### Logic patterns + `ANY` Matches anything + `NOT(A)` Match anything but `A` + `OR(A[, .. ])` Match if *one* of the arguments matches + `AND(A[, .. ])` Matches of *all* of the arguments match + +### String patterns + +`STRING` +Match any string. + +`STRING(string)` +Match a specific string. + +`STRING(regexp)` +Match a string via a `RegExp` object. + +`STRING(func)` +Match a string via a function predicate. + +`STRING(pattern)` +Match a string via a nested pattern. + + +### Number patterns + +`NUMBER` +`NUMBER(number)` +`NUMBER(min, max)` +`NUMBER(min, max, step)` +`NUMBER(func)` +`NUMBER(pattern)` +Matches a number + + XXX examples... ## Patterns (EXPERIMENTAL) -`NUMBER(min, max)` +`ARRAY` +`ARRAY(length)` + `IN(A)`