UNPKG

@lesnoypudge/utils

Version:

lesnoypudge's utils

47 lines (46 loc) 1.26 kB
var __defProp = Object.defineProperty; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); const withSelectors = (fn) => { fn.select = (selectFn) => { return (a, b) => fn(selectFn(a), selectFn(b)); }; return fn; }; class SortFns { constructor() { /** * Sort numbers from smallest to biggest. * * Alias to smallToBig. */ __publicField(this, "ascending", withSelectors((a, b) => { return a - b; })); /** * Sort numbers from smallest to biggest. * * Alias to ascending. */ __publicField(this, "smallToBig", this.ascending); /** * Sort numbers from biggest to smallest. * * Alias to bigToSmall. */ __publicField(this, "descending", withSelectors((a, b) => { return b - a; })); /** * Sort numbers from biggest to smallest. * * Alias to descending. */ __publicField(this, "bigToSmall", this.descending); } } const sortFns = { ...new SortFns() }; export { sortFns }; //# sourceMappingURL=sortFns.js.map