MCPcopy Index your code
hub / github.com/deployd/deployd / transform

Function transform

test-app/public/sinon.js:24414–24435  ·  view source on GitHub ↗

* An alternative to `_.reduce`; this method transforms `object` to a new * `accumulator` object which is the result of running each of its own * enumerable string keyed properties thru `iteratee`, with each invocation * potentially mutating the `accumulator` object. If `ac

(object, iteratee, accumulator)

Source from the content-addressed store, hash-verified

24412 * // => { '1': ['a', 'c'], '2': ['b'] }
24413 */
24414 function transform(object, iteratee, accumulator) {
24415 var isArr = isArray(object),
24416 isArrLike = isArr || isBuffer(object) || isTypedArray(object);
24417
24418 iteratee = getIteratee(iteratee, 4);
24419 if (accumulator == null) {
24420 var Ctor = object && object.constructor;
24421 if (isArrLike) {
24422 accumulator = isArr ? new Ctor : [];
24423 }
24424 else if (isObject(object)) {
24425 accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
24426 }
24427 else {
24428 accumulator = {};
24429 }
24430 }
24431 (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
24432 return iteratee(accumulator, value, index, object);
24433 });
24434 return accumulator;
24435 }
24436
24437 /**
24438 * Removes the property at `path` of `object`.

Callers 2

overArgFunction · 0.85
overRestFunction · 0.85

Calls 7

isBufferFunction · 0.85
isTypedArrayFunction · 0.85
getIterateeFunction · 0.85
iterateeFunction · 0.85
isArrayFunction · 0.70
isObjectFunction · 0.70
isFunctionFunction · 0.70

Tested by

no test coverage detected