diff options
author | Andrés Aldana <andres.aldana.martinez@gmail.com> | 2016-07-01 00:31:31 -0500 |
---|---|---|
committer | Andrés Aldana <andres.aldana.martinez@gmail.com> | 2016-07-01 00:31:31 -0500 |
commit | aaaa531a9bd0356ffde5bcb52da069c85e851ec5 (patch) | |
tree | dff7f503a0e19e519637f71aacd30151f755d2fb /lib | |
parent | 208a29e7ab375ab4f2882b38d184f9ac655b913b (diff) | |
download | async-aaaa531a9bd0356ffde5bcb52da069c85e851ec5.tar.gz |
Use lodash functions instead native functions
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reflectAll.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/reflectAll.js b/lib/reflectAll.js index 4492d1d..d444752 100644 --- a/lib/reflectAll.js +++ b/lib/reflectAll.js @@ -1,5 +1,7 @@ import reflect from './reflect'; import isArray from 'lodash/isArray'; +import map from 'lodash/map'; +import forIn from 'lodash/forIn'; /** * A helper function that wraps an array or an object of functions with reflect. @@ -70,12 +72,11 @@ import isArray from 'lodash/isArray'; export default function reflectAll(tasks) { var results; if (isArray(tasks)) { - results = tasks.map(reflect); + results = map(tasks, reflect); } else { - var keys = Object.keys(tasks); results = {}; - keys.forEach(function(key) { - results[key] = reflect.call(this, tasks[key]); + forIn(tasks, function(task, key) { + results[key] = reflect.call(this, task); }); } return results; |