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