create_ownership_validator() — svelte Function Reference
Architecture documentation for the create_ownership_validator() function in ownership.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD b9ef2508_e66f_3eaa_0cd0_203408254ada["create_ownership_validator()"] ad878f27_7e4b_5069_1b06_1750c58a617d["ownership.js"] b9ef2508_e66f_3eaa_0cd0_203408254ada -->|defined in| ad878f27_7e4b_5069_1b06_1750c58a617d 438bb219_6fe2_4e71_b04d_4bebd7b5ce48["is_bound_or_unset()"] b9ef2508_e66f_3eaa_0cd0_203408254ada -->|calls| 438bb219_6fe2_4e71_b04d_4bebd7b5ce48 28c6afed_f4f8_7245_50fe_f12a7fd10cba["sanitize_location()"] b9ef2508_e66f_3eaa_0cd0_203408254ada -->|calls| 28c6afed_f4f8_7245_50fe_f12a7fd10cba b44654f9_0789_6d16_ddf8_c8c069167d61["ownership_invalid_mutation()"] b9ef2508_e66f_3eaa_0cd0_203408254ada -->|calls| b44654f9_0789_6d16_ddf8_c8c069167d61 c5530e39_a229_e6a9_487d_f7fd0e3422f0["ownership_invalid_binding()"] b9ef2508_e66f_3eaa_0cd0_203408254ada -->|calls| c5530e39_a229_e6a9_487d_f7fd0e3422f0 style b9ef2508_e66f_3eaa_0cd0_203408254ada fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/internal/client/dev/ownership.js lines 16–66
export function create_ownership_validator(props) {
const component = component_context?.function;
const parent = component_context?.p?.function;
return {
/**
* @param {string} prop
* @param {any[]} path
* @param {any} result
* @param {number} line
* @param {number} column
*/
mutation: (prop, path, result, line, column) => {
const name = path[0];
if (is_bound_or_unset(props, name) || !parent) {
return result;
}
/** @type {any} */
let value = props;
for (let i = 0; i < path.length - 1; i++) {
value = value[path[i]];
if (!value?.[STATE_SYMBOL]) {
return result;
}
}
const location = sanitize_location(`${component[FILENAME]}:${line}:${column}`);
w.ownership_invalid_mutation(name, location, prop, parent[FILENAME]);
return result;
},
/**
* @param {any} key
* @param {any} child_component
* @param {() => any} value
*/
binding: (key, child_component, value) => {
if (!is_bound_or_unset(props, key) && parent && value()?.[STATE_SYMBOL]) {
w.ownership_invalid_binding(
component[FILENAME],
key,
child_component[FILENAME],
parent[FILENAME]
);
}
}
};
}
Domain
Subdomains
Source
Frequently Asked Questions
What does create_ownership_validator() do?
create_ownership_validator() is a function in the svelte codebase, defined in packages/svelte/src/internal/client/dev/ownership.js.
Where is create_ownership_validator() defined?
create_ownership_validator() is defined in packages/svelte/src/internal/client/dev/ownership.js at line 16.
What does create_ownership_validator() call?
create_ownership_validator() calls 4 function(s): is_bound_or_unset, ownership_invalid_binding, ownership_invalid_mutation, sanitize_location.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free