UNPKG

ts-useful

Version:

Functions for animation, color transitions, ecliptic, bezier, decasteljau, curves, three dimensional curves, smooth scrolling, random range, randomItem, mobius index, vectors, physics vectors, and easing.

15 lines 452 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Sorter = void 0; /** * * @param array any[] * @param prop string * @param reverse boolean * @returns any[] */ const Sorter = (array, prop, reverse = false) => { return array.sort((a, b) => ((a[prop] < b[prop]) ? (reverse ? 1 : -1) : (a[prop] > b[prop]) ? (reverse ? -1 : 1) : 0)); }; exports.Sorter = Sorter; //# sourceMappingURL=sorter.js.map