* Iterate each element of an object * @function * @param {Array|Object} obj object or an array to iterate * @param {Function} callback first argument is a value and second is a key. * @param {Object=} context Object to become context (`this`) for the iterator function.
(obj, callback, context)
| 1600 | * @param {Object=} context Object to become context (`this`) for the iterator function. |
| 1601 | */ |
| 1602 | function each(obj, callback, context) { |
| 1603 | if (!obj) { |
| 1604 | return ; |
| 1605 | } |
| 1606 | var key; |
| 1607 | // Is Array? |
| 1608 | // Array.isArray won't work, not only arrays can be iterated by index https://github.com/flowjs/ng-flow/issues/236# |
| 1609 | if (typeof(obj.length) !== 'undefined') { |
| 1610 | for (key = 0; key < obj.length; key++) { |
| 1611 | if (callback.call(context, obj[key], key) === false) { |
| 1612 | return ; |
| 1613 | } |
| 1614 | } |
| 1615 | } else { |
| 1616 | for (key in obj) { |
| 1617 | if (obj.hasOwnProperty(key) && callback.call(context, obj[key], key) === false) { |
| 1618 | return ; |
| 1619 | } |
| 1620 | } |
| 1621 | } |
| 1622 | } |
| 1623 | Flow.each = each; |
| 1624 | |
| 1625 | /** |
no outgoing calls
no test coverage detected
searching dependent graphs…