Chromium Code Reviews| Index: content/browser/resources/media/new/util.js |
| diff --git a/content/browser/resources/media/new/util.js b/content/browser/resources/media/new/util.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..adfcf4394a11c2b28352f341f0167cd5885d478a |
| --- /dev/null |
| +++ b/content/browser/resources/media/new/util.js |
| @@ -0,0 +1,29 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * @fileoverview Some utility functions that don't belong anywhere else in the |
| + * code. |
| + */ |
| + |
| +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
|
| +util.object = {}; |
| +/** |
| + * Calls a function for each element in an object/map/hash. |
| + * |
| + * @param {Object.<K,V>} obj The object over which to iterate. |
| + * @param {function(this:T,V,?,Object<K,V>):?} f The function to call |
| + * for every element. This function takes 3 arguments (the element, the |
| + * index and the object) and the return value is ignored. |
| + * @param {T=} opt_obj This is use as the 'this' object within f. |
| + */ |
|
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
|
| +util.object.forEach = function(obj, f, optObj) { |
| + 'use strict'; |
| + var key; |
| + for (key in obj) { |
| + if (obj.hasOwnProperty(key)) { |
| + f.call(optObj, obj[key], key, obj); |
| + } |
| + } |
| +}; |