Home / Function/ gram_counter() — svelte Function Reference

gram_counter() — svelte Function Reference

Architecture documentation for the gram_counter() function in fuzzymatch.js from the svelte codebase.

Function javascript Compiler Transformer calls 1 called by 2

Entity Profile

Dependency Diagram

graph TD
  ec638326_6d60_0f7e_e9c7_35ad5d1fac86["gram_counter()"]
  4057eb45_ab28_d989_1209_dfae45d590c0["fuzzymatch.js"]
  ec638326_6d60_0f7e_e9c7_35ad5d1fac86 -->|defined in| 4057eb45_ab28_d989_1209_dfae45d590c0
  ca5600fe_7b5d_97e9_53dc_da8efbfc4d4f["_add()"]
  ca5600fe_7b5d_97e9_53dc_da8efbfc4d4f -->|calls| ec638326_6d60_0f7e_e9c7_35ad5d1fac86
  cf7dc1ed_ad34_4633_c64c_6d82e53d4449["__get()"]
  cf7dc1ed_ad34_4633_c64c_6d82e53d4449 -->|calls| ec638326_6d60_0f7e_e9c7_35ad5d1fac86
  c1834035_6627_7f0e_9dce_dd323ec21055["iterate_grams()"]
  ec638326_6d60_0f7e_e9c7_35ad5d1fac86 -->|calls| c1834035_6627_7f0e_9dce_dd323ec21055
  style ec638326_6d60_0f7e_e9c7_35ad5d1fac86 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/phases/1-parse/utils/fuzzymatch.js lines 98–114

function gram_counter(value, gram_size = 2) {
	// return an object where key=gram, value=number of occurrences

	/** @type {Record<string, number>} */
	const result = {};
	const grams = iterate_grams(value, gram_size);
	let i = 0;

	for (i; i < grams.length; ++i) {
		if (grams[i] in result) {
			result[grams[i]] += 1;
		} else {
			result[grams[i]] = 1;
		}
	}
	return result;
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does gram_counter() do?
gram_counter() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/1-parse/utils/fuzzymatch.js.
Where is gram_counter() defined?
gram_counter() is defined in packages/svelte/src/compiler/phases/1-parse/utils/fuzzymatch.js at line 98.
What does gram_counter() call?
gram_counter() calls 1 function(s): iterate_grams.
What calls gram_counter()?
gram_counter() is called by 2 function(s): __get, _add.

Analyze Your Own Codebase

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

Try Supermodel Free