MCPcopy
hub / github.com/angular-ui/ui-router / hashKey

Function hashKey

test/angular/1.4/angular.js:3665–3683  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

3663 * The resulting string key is in 'type:hashKey' format.
3664 */
3665function hashKey(obj, nextUidFn) {
3666 var key = obj && obj.$$hashKey;
3667
3668 if (key) {
3669 if (typeof key === 'function') {
3670 key = obj.$$hashKey();
3671 }
3672 return key;
3673 }
3674
3675 var objType = typeof obj;
3676 if (objType == 'function' || (objType == 'object' && obj !== null)) {
3677 key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)();
3678 } else {
3679 key = objType + ':' + obj;
3680 }
3681
3682 return key;
3683}
3684
3685/**
3686 * HashMap which can use objects as keys

Callers 2

angular.jsFile · 0.70
parseOptionsExpressionFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected