In your examples, you have the rather impressive:
match({ '$v': '$y', '$x': [1,2,'$v'], i: '$x'}, { i: 'd', b: [23, 44], a: 3, c: 3, d: [1,2,'b']})
which works. However, much simpler matches do not work:
isMatch({'$a': '$b'}, {c: 5}); // false
isMatch({'$a': 5}, {c: 5}); // false
whereas
isMatch({c: '$b'}, {c: 5}); // true
But there is a problem - if you make the first two work then you then have some ambiguity issues:
match({'$a': 5}, {x: 5, y: 5, z: 5})
What on earth should '$a' be bound to in the resultant object? Or should you support a /g-like regex flag and be able to reissue the query and get the next result?
In your examples, you have the rather impressive:
which works. However, much simpler matches do not work:
whereas
But there is a problem - if you make the first two work then you then have some ambiguity issues:
What on earth should
'$a'be bound to in the resultant object? Or should you support a/g-like regex flag and be able to reissue the query and get the next result?