Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview Some utility functions that don't belong anywhere else in the | |
| 7 * code. | |
| 8 */ | |
| 9 | |
| 10 var util = {}; | |
|
scherkus (not reviewing)
2013/07/29 23:55:18
OOC is there a reason why this file doesn't use th
Ty Overby
2013/07/30 00:13:34
Because it doesn't need to? The only reason that
scherkus (not reviewing)
2013/07/30 03:12:08
Doesn't need to ... today ;)
(I'm fine leaving as
| |
| 11 util.object = {}; | |
| 12 /** | |
| 13 * Calls a function for each element in an object/map/hash. | |
| 14 * | |
| 15 * @param {Object.<K,V>} obj The object over which to iterate. | |
| 16 * @param {function(this:T,V,?,Object<K,V>):?} f The function to call | |
| 17 * for every element. This function takes 3 arguments (the element, the | |
| 18 * index and the object) and the return value is ignored. | |
| 19 * @param {T=} opt_obj This is use as the 'this' object within f. | |
| 20 */ | |
|
scherkus (not reviewing)
2013/07/29 23:55:18
this comment is copied verbatim from Apache-licens
Ty Overby
2013/07/30 00:13:34
The *code* was copied verbatim from the closure-cl
| |
| 21 util.object.forEach = function(obj, f, optObj) { | |
| 22 'use strict'; | |
| 23 var key; | |
| 24 for (key in obj) { | |
| 25 if (obj.hasOwnProperty(key)) { | |
| 26 f.call(optObj, obj[key], key, obj); | |
| 27 } | |
| 28 } | |
| 29 }; | |
| OLD | NEW |