- commit
- 29fb26d31c9fad68b1d366ee00db44b1aca2b507
- parent
- 98a798c195d58e419332835e588eef257706a780
- Author
- Tobias Bengfort <tobias.bengfort@gmx.net>
- Date
- 2015-08-31 07:09
make _.forEach more compatible with Array.prototype.forEach
Diffstat
| M | src/muu-js-helpers.js | 7 | ++++--- |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/muu-js-helpers.js b/src/muu-js-helpers.js
@@ -82,8 +82,9 @@ define('muu-js-helpers', [], function() {
82 82 };
83 83
84 84 /**
85 -1 * @param {Array} array
86 -1 * @param {Function} fn
-1 85 * @template T
-1 86 * @param {Array.<T>} array
-1 87 * @param {function(T, number, Array.<T>)} fn
87 88 */
88 89 _.forEach = function(array, fn) {
89 90 if ('forEach' in array) {
@@ -92,7 +93,7 @@ define('muu-js-helpers', [], function() {
92 93
93 94 var l = array.length;
94 95 for (var i = 0; i < l; i++) {
95 -1 fn(array[i]);
-1 96 fn(array[i], i, array);
96 97 }
97 98 };
98 99