* 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)
| 3829 | * The resulting string key is in 'type:hashKey' format. |
| 3830 | */ |
| 3831 | function hashKey(obj, nextUidFn) { |
| 3832 | var key = obj && obj.$$hashKey; |
| 3833 | |
| 3834 | if (key) { |
| 3835 | if (typeof key === 'function') { |
| 3836 | key = obj.$$hashKey(); |
| 3837 | } |
| 3838 | return key; |
| 3839 | } |
| 3840 | |
| 3841 | var objType = typeof obj; |
| 3842 | if (objType === 'function' || (objType === 'object' && obj !== null)) { |
| 3843 | key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)(); |
| 3844 | } else { |
| 3845 | key = objType + ':' + obj; |
| 3846 | } |
| 3847 | |
| 3848 | return key; |
| 3849 | } |
| 3850 | |
| 3851 | /** |
| 3852 | * HashMap which can use objects as keys |
no outgoing calls
no test coverage detected