UNPKG

@nestia/e2e

Version:

E2E test utilify functions

51 lines 2.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.json_equal_to = void 0; var json_equal_to = function (exception) { return function (x) { return function (y) { var container = []; var iterate = function (accessor) { return function (x) { return function (y) { if (typeof x === "function" || typeof y === "function") return; else if (typeof x !== typeof y) container.push(accessor); else if (x instanceof Array) if (!(y instanceof Array)) container.push(accessor); else array(accessor)(x)(y); else if (x instanceof Object) object(accessor)(x)(y); else if (x !== y) container.push(accessor); }; }; }; var array = function (accessor) { return function (x) { return function (y) { if (x.length !== y.length) container.push("".concat(accessor, ".length")); x.forEach(function (xItem, i) { return iterate("".concat(accessor, "[").concat(i, "]"))(xItem)(y[i]); }); }; }; }; var object = function (accessor) { return function (x) { return function (y) { return Object.keys(x) .filter(function (key) { return x[key] !== undefined && !exception(key); }) .forEach(function (key) { return iterate("".concat(accessor, ".").concat(key))(x[key])(y[key]); }); }; }; }; iterate("")(x)(y); return container; }; }; }; exports.json_equal_to = json_equal_to; //# sourceMappingURL=json_equal_to.js.map