* @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)
| 504 | * @returns {number} The size of `obj` or `0` if `obj` is neither an object nor an array. |
| 505 | */ |
| 506 | function size(obj, ownPropsOnly) { |
| 507 | var size = 0, key; |
| 508 | |
| 509 | if (isArray(obj) || isString(obj)) { |
| 510 | return obj.length; |
| 511 | } else if (isObject(obj)){ |
| 512 | for (key in obj) |
| 513 | if (!ownPropsOnly || obj.hasOwnProperty(key)) |
| 514 | size++; |
| 515 | } |
| 516 | |
| 517 | return size; |
| 518 | } |
| 519 | |
| 520 | |
| 521 | function includes(array, obj) { |