mirror of
https://github.com/flynx/diff.js.git
synced 2025-10-28 10:30:09 +00:00
docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
8e900bf5e5
commit
712c85ff37
14
README.md
14
README.md
@ -25,6 +25,7 @@
|
||||
- [Number patterns](#number-patterns)
|
||||
- [Array patterns](#array-patterns)
|
||||
- [Pattern variables](#pattern-variables)
|
||||
- [Miscellaneous patterns](#miscellaneous-patterns)
|
||||
- [Patterns (EXPERIMENTAL)](#patterns-experimental)
|
||||
- [JSON compatibility](#json-compatibility)
|
||||
- [Extending Diff](#extending-diff)
|
||||
@ -497,6 +498,19 @@ var o = {}
|
||||
cmp(P, [o, o, {}]) // -> true
|
||||
```
|
||||
|
||||
### Miscellaneous patterns
|
||||
|
||||
`TEST(function)`
|
||||
Matches if `function` returns true.
|
||||
|
||||
The `function` has the same signature as Pattern's `.__cmp__(obj, cmp, context)` and is run in the context of the `TEST` instance.
|
||||
|
||||
Example:
|
||||
```javascript
|
||||
var P = [ANY, ANY, TEST(e => !console.log('ELEM #3:', e))]
|
||||
|
||||
cmp(P, [1,2,3]) // prints: 'ELEM #3: 3'
|
||||
```
|
||||
|
||||
## Patterns (EXPERIMENTAL)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user