@walts81/linq-ts
Version:
Typescript/Javascript LINQ implementation library
12 lines (11 loc) • 390 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.orderBy = void 0;
const _common_1 = require("./_common");
Array.prototype.orderBy = orderBy;
function orderBy(selector = x => x, compare = _common_1.DefaultComparer) {
const arr = [].concat(this);
arr.sort((a, b) => compare(selector(a), selector(b)));
return arr;
}
exports.orderBy = orderBy;