json-joy
Version:
Collection of libraries for building collaborative editing apps.
14 lines (13 loc) • 512 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.execTest = void 0;
const deepEqual_1 = require("@jsonjoy.com/util/lib/json-equal/deepEqual");
const json_pointer_1 = require("@jsonjoy.com/json-pointer");
const execTest = (path, value, not, doc) => {
const { val } = (0, json_pointer_1.find)(doc, path);
if (val === undefined)
return !!not;
const test = (0, deepEqual_1.deepEqual)(val, value);
return not ? !test : test;
};
exports.execTest = execTest;
;