UNPKG

@nozbe/watermelondb

Version:

Build powerful React Native and React web apps that scale from hundreds to tens of thousands of records and remain fast

18 lines (15 loc) 302 B
// @flow export default function sortBy<T, U>(sorter: (T) => U, list: T[]): T[] { const clone = list.slice() let a let b return clone.sort((left, right) => { a = sorter(left) b = sorter(right) if (a === b) { return 0 } // $FlowFixMe return a < b ? -1 : 1 }) }