structured-elements
Version:
A TypeScript package for modelling and validating data
25 lines • 954 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildMirrorWithoutSorting = void 0;
const array_1 = require("../is/array");
const buildCollection_1 = require("./buildCollection");
const buildMirrorWithoutSorting = (data, options) => {
var _a;
if ((0, array_1.isArray)(data)) {
const collection = (0, buildCollection_1.buildMirrorCollection)(data, options);
return {
array: Object.freeze(data),
collection: Object.freeze(collection),
};
}
const collection = {
...(_a = options === null || options === void 0 ? void 0 : options.base) === null || _a === void 0 ? void 0 : _a.collection,
...data,
};
return {
array: Object.freeze(Object.values(collection)),
collection: Object.freeze(collection),
};
};
exports.buildMirrorWithoutSorting = buildMirrorWithoutSorting;
//# sourceMappingURL=buildWithoutSorting.js.map