summaryrefslogtreecommitdiff
path: root/lib/transform.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/transform.js')
-rw-r--r--lib/transform.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/transform.js b/lib/transform.js
index 6098522..175ad85 100644
--- a/lib/transform.js
+++ b/lib/transform.js
@@ -1,6 +1,8 @@
import isArray from 'lodash/isArray';
+import noop from 'lodash/noop';
import eachOf from './eachOf';
+import once from './internal/once';
/**
* A relative of `reduce`. Takes an Object or Array, and iterates over each
@@ -53,6 +55,7 @@ export default function transform (coll, accumulator, iteratee, callback) {
iteratee = accumulator;
accumulator = isArray(coll) ? [] : {};
}
+ callback = once(callback || noop);
eachOf(coll, function(v, k, cb) {
iteratee(accumulator, v, k, cb);