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

Function hashKey

lib/test/angular/1.5.0/angular.js:3679–3697  ·  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

3677 * The resulting string key is in 'type:hashKey' format.
3678 */
3679function hashKey(obj, nextUidFn) {
3680 var key = obj && obj.$$hashKey;
3681
3682 if (key) {
3683 if (typeof key === 'function') {
3684 key = obj.$$hashKey();
3685 }
3686 return key;
3687 }
3688
3689 var objType = typeof obj;
3690 if (objType == 'function' || (objType == 'object' && obj !== null)) {
3691 key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)();
3692 } else {
3693 key = objType + ':' + obj;
3694 }
3695
3696 return key;
3697}
3698
3699/**
3700 * 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