* 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)
| 4085 | * The resulting string key is in 'type:hashKey' format. |
| 4086 | */ |
| 4087 | function hashKey(obj, nextUidFn) { |
| 4088 | var key = obj && obj.$$hashKey; |
| 4089 | |
| 4090 | if (key) { |
| 4091 | if (typeof key === 'function') { |
| 4092 | key = obj.$$hashKey(); |
| 4093 | } |
| 4094 | return key; |
| 4095 | } |
| 4096 | |
| 4097 | var objType = typeof obj; |
| 4098 | if (objType === 'function' || (objType === 'object' && obj !== null)) { |
| 4099 | key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)(); |
| 4100 | } else { |
| 4101 | key = objType + ':' + obj; |
| 4102 | } |
| 4103 | |
| 4104 | return key; |
| 4105 | } |
| 4106 | |
| 4107 | // A minimal ES2015 Map implementation. |
| 4108 | // Should be bug/feature equivalent to the native implementations of supported browsers |
no outgoing calls
no test coverage detected