Home / Function/ shorthash() — astro Function Reference

shorthash() — astro Function Reference

Architecture documentation for the shorthash() function in shorthash.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  e7eb71b4_4909_3f1b_44fa_140138298bae["shorthash()"]
  1931224b_3710_e27c_adb3_a9fbb99cec90["shorthash.ts"]
  e7eb71b4_4909_3f1b_44fa_140138298bae -->|defined in| 1931224b_3710_e27c_adb3_a9fbb99cec90
  ab9ac294_9bdd_8583_b24f_ee7907d60dd7["bitwise()"]
  e7eb71b4_4909_3f1b_44fa_140138298bae -->|calls| ab9ac294_9bdd_8583_b24f_ee7907d60dd7
  style e7eb71b4_4909_3f1b_44fa_140138298bae fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/runtime/server/shorthash.ts lines 47–67

export function shorthash(text: string) {
	let num: number;
	let result = '';

	let integer = bitwise(text);
	const sign = integer < 0 ? 'Z' : ''; // If it's negative, start with Z, which isn't in the dictionary

	integer = Math.abs(integer);

	while (integer >= binary) {
		num = integer % binary;
		integer = Math.floor(integer / binary);
		result = dictionary[num] + result;
	}

	if (integer > 0) {
		result = dictionary[integer] + result;
	}

	return sign + result;
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does shorthash() do?
shorthash() is a function in the astro codebase, defined in packages/astro/src/runtime/server/shorthash.ts.
Where is shorthash() defined?
shorthash() is defined in packages/astro/src/runtime/server/shorthash.ts at line 47.
What does shorthash() call?
shorthash() calls 1 function(s): bitwise.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free