* 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)
| 4063 | * The resulting string key is in 'type:hashKey' format. |
| 4064 | */ |
| 4065 | function hashKey(obj, nextUidFn) { |
| 4066 | var key = obj && obj.$$hashKey; |
| 4067 | |
| 4068 | if (key) { |
| 4069 | if (typeof key === 'function') { |
| 4070 | key = obj.$$hashKey(); |
| 4071 | } |
| 4072 | return key; |
| 4073 | } |
| 4074 | |
| 4075 | var objType = typeof obj; |
| 4076 | if (objType === 'function' || (objType === 'object' && obj !== null)) { |
| 4077 | key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)(); |
| 4078 | } else { |
| 4079 | key = objType + ':' + obj; |
| 4080 | } |
| 4081 | |
| 4082 | return key; |
| 4083 | } |
| 4084 | |
| 4085 | // A minimal ES2015 Map implementation. |
| 4086 | // Should be bug/feature equivalent to the native implementations of supported browsers |
no outgoing calls
no test coverage detected