* An iteration utility for arrays and objects. * * @private * @param {Array|Object} object The object to iterate over. * @param {Function} callback The function called per iteration.
(object, callback)
| 129 | * @param {Function} callback The function called per iteration. |
| 130 | */ |
| 131 | function each(object, callback) { |
| 132 | var index = -1, |
| 133 | length = object ? object.length : 0; |
| 134 | |
| 135 | if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) { |
| 136 | while (++index < length) { |
| 137 | callback(object[index], index, object); |
| 138 | } |
| 139 | } else { |
| 140 | forOwn(object, callback); |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | /** |
| 145 | * Trim and conditionally capitalize string values. |