UNPKG

mongorai

Version:

Light MongoDB client for the web. Minimalistic UI used React with minimum dependencies.

22 lines (21 loc) 725 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Utils = void 0; var Utils; (function (Utils) { Utils.fieldSort = (arr, field, descending = false) => { return arr.sort((a, b) => { const aVal = a[field]; const bVal = b[field]; if (aVal === bVal) return 0; if (aVal === undefined || aVal === null) return descending ? -1 : 1; if (bVal === undefined || bVal === null) return descending ? 1 : -1; return (aVal > bVal) ? (descending ? -1 : 1) : (descending ? 1 : -1); }); }; })(Utils || (exports.Utils = Utils = {}));