MCPcopy
hub / github.com/caolan/async / transform

Function transform

lib/transform.js:50–64  ·  view source on GitHub ↗
(coll, accumulator, iteratee, callback)

Source from the content-addressed store, hash-verified

48 * })
49 */
50export default function transform (coll, accumulator, iteratee, callback) {
51 if (arguments.length <= 3) {
52 callback = iteratee;
53 iteratee = accumulator;
54 accumulator = isArray(coll) ? [] : {};
55 }
56 callback = once(callback || noop);
57 var _iteratee = wrapAsync(iteratee);
58
59 eachOf(coll, function(v, k, cb) {
60 _iteratee(accumulator, v, k, cb);
61 }, function(err) {
62 callback(err, accumulator);
63 });
64}

Callers

nothing calls this directly

Calls 2

onceFunction · 0.85
wrapAsyncFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…