diff options
Diffstat (limited to 'build-es/sortBy.js')
-rw-r--r-- | build-es/sortBy.js | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/build-es/sortBy.js b/build-es/sortBy.js deleted file mode 100644 index 75d61ca..0000000 --- a/build-es/sortBy.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; - -import arrayMap from 'lodash-es/_arrayMap'; -import property from 'lodash-es/_baseProperty'; - -import map from './map'; - -export default function sortBy (arr, iterator, cb) { - map(arr, function (x, cb) { - iterator(x, function (err, criteria) { - if (err) return cb(err); - cb(null, {value: x, criteria: criteria}); - }); - }, function (err, results) { - if (err) return cb(err); - cb(null, arrayMap(results.sort(comparator), property('value'))); - }); - - function comparator(left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - } -} |