* 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)
| 3677 | * The resulting string key is in 'type:hashKey' format. |
| 3678 | */ |
| 3679 | function hashKey(obj, nextUidFn) { |
| 3680 | var key = obj && obj.$$hashKey; |
| 3681 | |
| 3682 | if (key) { |
| 3683 | if (typeof key === 'function') { |
| 3684 | key = obj.$$hashKey(); |
| 3685 | } |
| 3686 | return key; |
| 3687 | } |
| 3688 | |
| 3689 | var objType = typeof obj; |
| 3690 | if (objType == 'function' || (objType == 'object' && obj !== null)) { |
| 3691 | key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)(); |
| 3692 | } else { |
| 3693 | key = objType + ':' + obj; |
| 3694 | } |
| 3695 | |
| 3696 | return key; |
| 3697 | } |
| 3698 | |
| 3699 | /** |
| 3700 | * HashMap which can use objects as keys |
no outgoing calls
no test coverage detected