* Computes a hash of an 'obj'. * Hash of a: * string is string * number is number as string * object is either result of calling $$hashKey function on the object or uniquely generated id, * that is also assigned to the $$hashKey property of the object. * * @param obj * @returns {s
(obj, nextUidFn)
| 3663 | * The resulting string key is in 'type:hashKey' format. |
| 3664 | */ |
| 3665 | function hashKey(obj, nextUidFn) { |
| 3666 | var key = obj && obj.$$hashKey; |
| 3667 | |
| 3668 | if (key) { |
| 3669 | if (typeof key === 'function') { |
| 3670 | key = obj.$$hashKey(); |
| 3671 | } |
| 3672 | return key; |
| 3673 | } |
| 3674 | |
| 3675 | var objType = typeof obj; |
| 3676 | if (objType == 'function' || (objType == 'object' && obj !== null)) { |
| 3677 | key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)(); |
| 3678 | } else { |
| 3679 | key = objType + ':' + obj; |
| 3680 | } |
| 3681 | |
| 3682 | return key; |
| 3683 | } |
| 3684 | |
| 3685 | /** |
| 3686 | * HashMap which can use objects as keys |
no outgoing calls
no test coverage detected