Every line of 'foreach object javascript' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
276 export function objectForEach( 277 obj: { [key: string]: V }, 278 cb: (value: V, key: string) => void 279 ): void { 280 Object.keys(obj).forEach(key => cb(obj[key], key)); 281 }
25 function forEach(object, callback, context) { 26 var index, length; 27 if (object.length) { 28 if (Array.prototype.forEach) { 29 Array.prototype.forEach.call(object, callback, context); 30 } else { 31 for (index = 0, length = object.length; index < length; index += 1) { 32 callback.call(context || this, object[index], index, object); 33 } 34 } 35 } else { 36 for (index in object) { 37 if (object.hasOwnProperty(index)) { 38 callback.call(context || this, object[index], index, object); 39 } 40 } 41 } 42 }
4 export function forEach(obj, callback) { 5 if (obj) { 6 Object.keys(obj).forEach((key) => { 7 // eslint-disable-line no-restricted-syntax 8 if ({}.hasOwnProperty.call(obj, key)) { 9 callback(key, obj[key]); 10 } 11 }); 12 } 13 }
1026 export function foreach(obj: { [key: string]: V }, action: (key: string, value: V) => void) { 1027 1028 for (const name in obj) { 1029 if (obj.hasOwnProperty == null || obj.hasOwnProperty(name)) { 1030 action(name, obj[name]); 1031 } 1032 } 1033 }
48 function _do(f) { 49 var i, values; 50 for(; a
57 function forEach(o, fn) { 58 if (Array.isArray(o)) { 59 return o.forEach(fn); 60 } 61 else { 62 for (var key in o) { 63 if (o.hasOwnProperty(key)) { 64 fn(o[key], key) 65 } 66 } 67 } 68 }
782 function forEach(callback, context){ 783 var index = 0, 784 self = this; 785 mforEach(unwrap(this), function(key){ 786 call(callback, this, key, index++, self); 787 }, context); 788 }