UNPKG

structured-elements

Version:

A TypeScript package for modelling and validating data

19 lines 765 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.sortMirror = void 0; const buildCollection_1 = require("./buildCollection"); const sortMirror = ({ mirror, options, }) => { const array = [...mirror.array].sort(options.sort); return { array: Object.freeze(array), collection: Object.freeze((0, buildCollection_1.buildMirrorCollection)(array, { ...options, // The base option is for when we're building a new version of a // mirror with changed data. We aren't doing that here; we just want // to build a sorted version of the existing data. base: undefined, })), }; }; exports.sortMirror = sortMirror; //# sourceMappingURL=sort.js.map