json-joy
Version:
Collection of libraries for building collaborative editing apps.
10 lines (9 loc) • 335 B
JavaScript
import { deepEqual } from '@jsonjoy.com/util/lib/json-equal/deepEqual';
import { find } from '@jsonjoy.com/json-pointer';
export const execTest = (path, value, not, doc) => {
const { val } = find(doc, path);
if (val === undefined)
return !!not;
const test = deepEqual(val, value);
return not ? !test : test;
};