UNPKG

@signaldb/core

Version:

SignalDB is a client-side database that provides a simple MongoDB-like interface to the data with first-class typescript support to achieve an optimistic UI. Data persistence can be achieved by using storage providers that store the data through a JSON in

11 lines (10 loc) 347 B
"use strict"; const fastSort = require("fast-sort"); const get = require("./index.cjs25.js"); function sortItems(items, sortFields) { return fastSort.sort(items).by(Object.entries(sortFields).map(([key, value]) => { const order = value === 1 ? "asc" : "desc"; return { [order]: (i) => get(i, key) }; })); } module.exports = sortItems;