MCPcopy Create free account
hub / github.com/angular-ui/ui-router / hashKey

Function hashKey

test/angular/1.5/angular.js:3831–3849  ·  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

3829 * The resulting string key is in 'type:hashKey' format.
3830 */
3831function hashKey(obj, nextUidFn) {
3832 var key = obj && obj.$$hashKey;
3833
3834 if (key) {
3835 if (typeof key === 'function') {
3836 key = obj.$$hashKey();
3837 }
3838 return key;
3839 }
3840
3841 var objType = typeof obj;
3842 if (objType === 'function' || (objType === 'object' && obj !== null)) {
3843 key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)();
3844 } else {
3845 key = objType + ':' + obj;
3846 }
3847
3848 return key;
3849}
3850
3851/**
3852 * 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