UNPKG

iso-weeks-year

Version:
16 lines 524 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.orderBy = void 0; function orderBy(arr, props, orders) { return [...arr].sort((a, b) => props.reduce((acc, prop, i) => { if (acc === 0) { const [p1, p2] = orders && orders[i] === 'desc' ? [b[prop], a[prop]] : [a[prop], b[prop]]; acc = p1 > p2 ? 1 : p1 < p2 ? -1 : 0; } return acc; }, 0)); } exports.orderBy = orderBy; //# sourceMappingURL=order.js.map