MCPcopy Create free account
hub / github.com/apache/cloudstack / hashKey

Function hashKey

tools/ngui/static/js/lib/angular.js:2228–2244  ·  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)

Source from the content-addressed store, hash-verified

2226 * The resulting string key is in 'type:hashKey' format.
2227 */
2228function hashKey(obj) {
2229 var objType = typeof obj,
2230 key;
2231
2232 if (objType == 'object' && obj !== null) {
2233 if (typeof (key = obj.$$hashKey) == 'function') {
2234 // must invoke on object to keep the right this
2235 key = obj.$$hashKey();
2236 } else if (key === undefined) {
2237 key = obj.$$hashKey = nextUid();
2238 }
2239 } else {
2240 key = obj;
2241 }
2242
2243 return objType + ':' + key;
2244}
2245
2246/**
2247 * HashMap which can use objects as keys

Callers 1

angular.jsFile · 0.85

Calls 1

nextUidFunction · 0.85

Tested by

no test coverage detected