MCPcopy
hub / github.com/angular/angular / byteStringToDecString

Function byteStringToDecString

packages/service-worker/worker/src/sha1.ts:179–189  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

177
178// based on https://www.danvk.org/hex2dec.html (JS can not handle more than 56b)
179function byteStringToDecString(str: string): string {
180 let decimal = '';
181 let toThePower = '1';
182
183 for (let i = str.length - 1; i >= 0; i--) {
184 decimal = addBigInt(decimal, numberTimesBigInt(byteAt(str, i), toThePower));
185 toThePower = numberTimesBigInt(256, toThePower);
186 }
187
188 return decimal.split('').reverse().join('');
189}
190
191// x and y decimal, lowest significant digit first
192function addBigInt(x: string, y: string): string {

Callers

nothing calls this directly

Calls 5

reverseMethod · 0.80
addBigIntFunction · 0.70
numberTimesBigIntFunction · 0.70
byteAtFunction · 0.70
joinMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…