mjhm / lodash-match-pattern

Deep JSON pattern matching library
MIT License
50 stars 3 forks source link

How to return a list of all non-matches key/value pairs #38

Open snoblenet opened 6 years ago

snoblenet commented 6 years ago

When comparing two objects that have two non-matching key/value pairs, I'm only alerted to one of the differences. This occurs in both chai-match-pattern and the CLI:

> const matchPattern = require('lodash-match-pattern');
undefined
> matchPattern
{ [Function: matchPattern] use: [Function], getLodashModule: [Function] }
> matchPattern({ a: 1, b: 1, c: 1 }, { a: 2, b:2, c:1 })
'{a: 1} didn\'t match target {a: 2}'

However, I believe you are using Checkit, and it's documentation indicates that a hash of all non-matching key/values is provided:

https://github.com/tgriesser/checkit#checkiterror

Is it possible for lodash-match-pattern to start passing on all this information?