feature: add sortBy helper function
This commit is contained in:
parent
c283c8593d
commit
de90f9de21
|
@ -0,0 +1,4 @@
|
||||||
|
// @flow
|
||||||
|
/* eslint-disable max-len */
|
||||||
|
// $FlowFixMe
|
||||||
|
export default <T>(field: string) => (arr: T[]): T[] => arr.sort((a, b) => (a[field] < b[field] ? 1 : -1));
|
Loading…
Reference in New Issue