* 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)
| 4174 | * The resulting string key is in 'type:hashKey' format. |
| 4175 | */ |
| 4176 | function hashKey(obj, nextUidFn) { |
| 4177 | var key = obj && obj.$$hashKey; |
| 4178 | |
| 4179 | if (key) { |
| 4180 | if (typeof key === 'function') { |
| 4181 | key = obj.$$hashKey(); |
| 4182 | } |
| 4183 | return key; |
| 4184 | } |
| 4185 | |
| 4186 | var objType = typeof obj; |
| 4187 | if (objType === 'function' || (objType === 'object' && obj !== null)) { |
| 4188 | key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)(); |
| 4189 | } else { |
| 4190 | key = objType + ':' + obj; |
| 4191 | } |
| 4192 | |
| 4193 | return key; |
| 4194 | } |
| 4195 | |
| 4196 | // A minimal ES2015 Map implementation. |
| 4197 | // Should be bug/feature equivalent to the native implementations of supported browsers |
no outgoing calls
no test coverage detected