feature: add sortBy helper function

This commit is contained in:
George Lima 2019-01-08 12:59:51 -03:00
parent c283c8593d
commit de90f9de21
1 changed files with 4 additions and 0 deletions

4
app/utils/sortBy.js Normal file
View File

@ -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));