Every line of 'object keys foreach' 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<V>( 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 }
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
1026 export function foreach<V>(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 }
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 }
28 function forEach(obj, fn) { 29 Object.keys(obj).forEach(function(name, index) { 30 fn(obj[name], name, index); 31 }); 32 }
34 public forEach( cb : ( element : V, key : string, map : ObjectMap<V> ) => any, thisArg : any ) { 35 for( var i in this._map ) { 36 if( this._map.hasOwnProperty( i ) ) { 37 cb.call( thisArg, this._map[i], i, this ); 38 } 39 } 40 }
5 function forEach(haystack, callback, scope) { 6 if (Object.prototype.toString.call(haystack) === '[object Object]') { 7 var keyHaystack = Object.keys(haystack); 8 for (var i = 0, len = keyHaystack.length; i < len; i += 1) { 9 if (Object.prototype.hasOwnProperty.call(keyHaystack, i)) { 10 callback.call(scope, haystack[keyHaystack[i]], keyHaystack[i], haystack); 11 } 12 } 13 } 14 else { 15 for (var i = 0, len = haystack.length; i < len; i += 1) { 16 callback.call(scope, haystack[i], i, haystack); 17 } 18 } 19 }
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 }
133 forEach(callbackfn: (value: V, index: K, map: this) => void, thisArg?: any): void { 134 for (const property of Object.keys(this._keys)) { 135 callbackfn.call(thisArg, this._values[property], this._keys[property], this); 136 } 137 }
23 function forEachKey(object, transformers, propKeys, k) { 24 var v = object[k]; 25 26 if (propKeys.hasOwnProperty(k)) { 27 object[k] = transformers.reduce(reducer, v); 28 return; 29 } 30 if (!(typeof v === 'object' && v !== null)) return; 31 iterate(v, transformers, propKeys); 32 }
136 export function forEach(key: ReferenceNode, collection: ReferenceNode, expressions: Expression[]): ForEachNode { 137 return { 138 kind: 'ForEach', 139 key, 140 collection, 141 expressions, 142 }; 143 }