summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Early <alexander.early@gmail.com>2016-07-02 18:55:11 -0700
committerGitHub <noreply@github.com>2016-07-02 18:55:11 -0700
commitab3c5054d0569d09fea69b4f956be44a5d03aa42 (patch)
tree9326c1a492430b49a94f3c0a4f5908a5923e12e9
parent9527b324dae49c92c12beca2b2630b1c36dae084 (diff)
parent4468e767f82a867586a857683a7c5b06b67994ad (diff)
downloadasync-ab3c5054d0569d09fea69b4f956be44a5d03aa42.tar.gz
Merge pull request #1208 from andalm/reflectall-use-lodash
ReflectAll, use lodash functions instead native functions
-rw-r--r--lib/reflectAll.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/reflectAll.js b/lib/reflectAll.js
index 4492d1d..edfed49 100644
--- a/lib/reflectAll.js
+++ b/lib/reflectAll.js
@@ -1,5 +1,7 @@
import reflect from './reflect';
import isArray from 'lodash/isArray';
+import _arrayMap from 'lodash/_arrayMap';
+import forOwn from 'lodash/forOwn';
/**
* 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 = _arrayMap(tasks, reflect);
} else {
- var keys = Object.keys(tasks);
results = {};
- keys.forEach(function(key) {
- results[key] = reflect.call(this, tasks[key]);
+ forOwn(tasks, function(task, key) {
+ results[key] = reflect.call(this, task);
});
}
return results;