* 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)
| 4109 | * The resulting string key is in 'type:hashKey' format. |
| 4110 | */ |
| 4111 | function hashKey(obj, nextUidFn) { |
| 4112 | var key = obj && obj.$$hashKey; |
| 4113 | |
| 4114 | if (key) { |
| 4115 | if (typeof key === 'function') { |
| 4116 | key = obj.$$hashKey(); |
| 4117 | } |
| 4118 | return key; |
| 4119 | } |
| 4120 | |
| 4121 | var objType = typeof obj; |
| 4122 | if (objType === 'function' || (objType === 'object' && obj !== null)) { |
| 4123 | key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)(); |
| 4124 | } else { |
| 4125 | key = objType + ':' + obj; |
| 4126 | } |
| 4127 | |
| 4128 | return key; |
| 4129 | } |
| 4130 | |
| 4131 | // A minimal ES2015 Map implementation. |
| 4132 | // Should be bug/feature equivalent to the native implementations of supported browsers |
no outgoing calls
no test coverage detected