From de90f9de21c85b87d34fbf47809299b740edab52 Mon Sep 17 00:00:00 2001 From: George Lima Date: Tue, 8 Jan 2019 12:59:51 -0300 Subject: [PATCH] feature: add sortBy helper function --- app/utils/sortBy.js | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 app/utils/sortBy.js diff --git a/app/utils/sortBy.js b/app/utils/sortBy.js new file mode 100644 index 0000000..25a102e --- /dev/null +++ b/app/utils/sortBy.js @@ -0,0 +1,4 @@ +// @flow +/* eslint-disable max-len */ +// $FlowFixMe +export default (field: string) => (arr: T[]): T[] => arr.sort((a, b) => (a[field] < b[field] ? 1 : -1));