This commit is contained in:
Tom Moor 2018-05-19 15:12:19 -07:00
parent bc9d75fcae
commit a4b5d6cabe

View File

@ -1,9 +1,8 @@
// @flow
import _ from 'lodash';
import naturalSort from 'natural-sort';
export default (sortableArray: Object[], key: string) => {
export default (sortableArray: Object[] = [], key: string) => {
let keys = sortableArray.map(object => object[key]);
keys.sort(naturalSort());
return _.sortBy(sortableArray, object => keys.indexOf(object[key]));