MCPcopy Create free account
hub / github.com/activejs/activejs / hashCode

Function hashCode

packages/core/src/utils/funcs.ts:331–345  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

329 * @internal please do not use.
330 */
331export function hashCode(str: string): string {
332 // tslint:disable:no-bitwise
333 let hash = 0;
334 const length = typeof str === 'string' ? str.length : 0;
335 if (length === 0) {
336 return String(hash);
337 }
338 for (let i = 0; i < length; i++) {
339 hash = (hash << 5) - hash + str.charCodeAt(i);
340 hash |= 0; // Convert to 32bit integer
341 }
342 hash = hash >>> 0;
343 return Number(hash).toString(32).toUpperCase();
344 // tslint:enable:no-bitwise
345}
346
347/**
348 * @internal please do not use.

Callers 2

extras.spec.tsFile · 0.90
getLocationIdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected