UNPKG

mongoku

Version:

MongoDB client for the web. Query your data directly from your browser. You can host it locally, or anywhere else, for you and your team.

21 lines (20 loc) 670 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var Utils; (function (Utils) { /** * In-place sort of the given array of objects * @param arr An array of objects * @param field the field used to sort * @param descending whether to use descending order */ Utils.fieldSort = (arr, field, descending = false) => { return arr.sort((a, b) => { return (a[field] == b[field]) ? 0 : (a[field] > b[field]) ? (descending) ? -1 : 1 : (descending) ? 1 : -1; }); }; })(Utils = exports.Utils || (exports.Utils = {}));