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

Function nextUid

tools/ngui/static/js/lib/angular.js:181–201  ·  view source on GitHub ↗

* A consistent way of creating unique IDs in angular. The ID is a sequence of alpha numeric * characters such as '012ABC'. The reason why we are not using simply a number counter is that * the number string gets longer over time, and it can also overflow, where as the nextId * will grow much slow

()

Source from the content-addressed store, hash-verified

179 * @returns an unique alpha-numeric string
180 */
181function nextUid() {
182 var index = uid.length;
183 var digit;
184
185 while(index) {
186 index--;
187 digit = uid[index].charCodeAt(0);
188 if (digit == 57 /*'9'*/) {
189 uid[index] = 'A';
190 return uid.join('');
191 }
192 if (digit == 90 /*'Z'*/) {
193 uid[index] = '0';
194 } else {
195 uid[index] = String.fromCharCode(digit + 1);
196 return uid.join('');
197 }
198 }
199 uid.unshift('0');
200 return uid.join('');
201}
202
203
204/**

Callers 4

hashKeyFunction · 0.85
ScopeFunction · 0.85
$RootScopeProviderFunction · 0.85
radioInputTypeFunction · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected