* @description * Determines the number of elements in an array, the number of properties an object has, or * the length of a string. * * Note: This function is used to augment the Object type in Angular expressions. See * angular.Object for more information about Angular arrays. * * @
(obj, ownPropsOnly)
| 696 | * @returns {number} The size of `obj` or `0` if `obj` is neither an object nor an array. |
| 697 | */ |
| 698 | function size(obj, ownPropsOnly) { |
| 699 | var count = 0, key; |
| 700 | |
| 701 | if (isArray(obj) || isString(obj)) { |
| 702 | return obj.length; |
| 703 | } else if (isObject(obj)){ |
| 704 | for (key in obj) |
| 705 | if (!ownPropsOnly || obj.hasOwnProperty(key)) |
| 706 | count++; |
| 707 | } |
| 708 | |
| 709 | return count; |
| 710 | } |
| 711 | |
| 712 | |
| 713 | function includes(array, obj) { |