* 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)
| 3558 | * The resulting string key is in 'type:hashKey' format. |
| 3559 | */ |
| 3560 | function hashKey(obj, nextUidFn) { |
| 3561 | var key = obj && obj.$$hashKey; |
| 3562 | |
| 3563 | if (key) { |
| 3564 | if (typeof key === 'function') { |
| 3565 | key = obj.$$hashKey(); |
| 3566 | } |
| 3567 | return key; |
| 3568 | } |
| 3569 | |
| 3570 | var objType = typeof obj; |
| 3571 | if (objType == 'function' || (objType == 'object' && obj !== null)) { |
| 3572 | key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)(); |
| 3573 | } else { |
| 3574 | key = objType + ':' + obj; |
| 3575 | } |
| 3576 | |
| 3577 | return key; |
| 3578 | } |
| 3579 | |
| 3580 | /** |
| 3581 | * HashMap which can use objects as keys |
no outgoing calls
no test coverage detected