_add() — svelte Function Reference
Architecture documentation for the _add() function in fuzzymatch.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD ca5600fe_7b5d_97e9_53dc_da8efbfc4d4f["_add()"] 79034f27_7e89_3edc_1524_ef7e1cf114bf["FuzzySet"] ca5600fe_7b5d_97e9_53dc_da8efbfc4d4f -->|defined in| 79034f27_7e89_3edc_1524_ef7e1cf114bf e9e928cd_ecf3_b386_9b42_407f2fa12962["add()"] e9e928cd_ecf3_b386_9b42_407f2fa12962 -->|calls| ca5600fe_7b5d_97e9_53dc_da8efbfc4d4f ec638326_6d60_0f7e_e9c7_35ad5d1fac86["gram_counter()"] ca5600fe_7b5d_97e9_53dc_da8efbfc4d4f -->|calls| ec638326_6d60_0f7e_e9c7_35ad5d1fac86 style ca5600fe_7b5d_97e9_53dc_da8efbfc4d4f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/phases/1-parse/utils/fuzzymatch.js lines 164–189
_add(value, gram_size) {
const normalized_value = value.toLowerCase();
const items = this.items[gram_size] || [];
const index = items.length;
items.push(0);
const gram_counts = gram_counter(normalized_value, gram_size);
let sum_of_square_gram_counts = 0;
let gram;
let gram_count;
for (gram in gram_counts) {
gram_count = gram_counts[gram];
sum_of_square_gram_counts += Math.pow(gram_count, 2);
if (gram in this.match_dict) {
this.match_dict[gram].push([index, gram_count]);
} else {
this.match_dict[gram] = [[index, gram_count]];
}
}
const vector_normal = Math.sqrt(sum_of_square_gram_counts);
// @ts-ignore no idea what this code is doing
items[index] = [vector_normal, normalized_value];
this.items[gram_size] = items;
this.exact_set[normalized_value] = value;
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does _add() do?
_add() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/1-parse/utils/fuzzymatch.js.
Where is _add() defined?
_add() is defined in packages/svelte/src/compiler/phases/1-parse/utils/fuzzymatch.js at line 164.
What does _add() call?
_add() calls 1 function(s): gram_counter.
What calls _add()?
_add() is called by 1 function(s): add.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free