MCPcopy
hub / github.com/jlmakes/scrollreveal / each

Function each

src/utils/each.js:3–12  ·  view source on GitHub ↗
(collection, callback)

Source from the content-addressed store, hash-verified

1import isObject from './is-object'
2
3export default function each(collection, callback) {
4 if (isObject(collection)) {
5 const keys = Object.keys(collection)
6 return keys.forEach(key => callback(collection[key], key, collection))
7 }
8 if (collection instanceof Array) {
9 return collection.forEach((item, i) => callback(item, i, collection))
10 }
11 throw new TypeError('Expected either an array or object literal.')
12}

Callers 11

each.spec.jsFile · 0.85
deepAssignFunction · 0.85
SequenceModelFunction · 0.85
initializeFunction · 0.85
rinseFunction · 0.85
delegateFunction · 0.85
syncFunction · 0.85
revealFunction · 0.85
getContainerIdFunction · 0.85
destroyFunction · 0.85
cleanFunction · 0.85

Calls 1

isObjectFunction · 0.85

Tested by

no test coverage detected