Home / File/ assign.js — svelte Source File

assign.js — svelte Source File

Architecture documentation for assign.js, a javascript file in the svelte codebase. 6 imports, 0 dependents.

File javascript ClientRuntime Hydration 6 imports 5 functions

Entity Profile

Dependency Diagram

graph LR
  913babd4_e776_0bee_9cf6_afebad5ec947["assign.js"]
  2aa63f4e_82c9_33e3_ac6c_5f3d46250522["utils.js"]
  913babd4_e776_0bee_9cf6_afebad5ec947 --> 2aa63f4e_82c9_33e3_ac6c_5f3d46250522
  28c6afed_f4f8_7245_50fe_f12a7fd10cba["sanitize_location"]
  913babd4_e776_0bee_9cf6_afebad5ec947 --> 28c6afed_f4f8_7245_50fe_f12a7fd10cba
  bde4209f_8ffc_1594_4024_b1835a44bcf6["runtime.js"]
  913babd4_e776_0bee_9cf6_afebad5ec947 --> bde4209f_8ffc_1594_4024_b1835a44bcf6
  a814b193_e12a_4037_c3c8_dfd45f3bd0bb["untrack"]
  913babd4_e776_0bee_9cf6_afebad5ec947 --> a814b193_e12a_4037_c3c8_dfd45f3bd0bb
  df278ca2_0a6c_fefe_09f2_b397500fe3c2["warnings.js"]
  913babd4_e776_0bee_9cf6_afebad5ec947 --> df278ca2_0a6c_fefe_09f2_b397500fe3c2
  54c2bfce_50b6_b8cc_4371_e1e14f283fb3["constants"]
  913babd4_e776_0bee_9cf6_afebad5ec947 --> 54c2bfce_50b6_b8cc_4371_e1e14f283fb3
  style 913babd4_e776_0bee_9cf6_afebad5ec947 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { STATE_SYMBOL } from '#client/constants';
import { sanitize_location } from '../../../utils.js';
import { untrack } from '../runtime.js';
import * as w from '../warnings.js';

/**
 *
 * @param {any} a
 * @param {any} b
 * @param {string} property
 * @param {string} location
 */
function compare(a, b, property, location) {
	if (a !== b && typeof b === 'object' && STATE_SYMBOL in b) {
		w.assignment_value_stale(property, /** @type {string} */ (sanitize_location(location)));
	}

	return a;
}

/**
 * @param {any} object
 * @param {string} property
 * @param {any} value
 * @param {string} location
 */
export function assign(object, property, value, location) {
	return compare(
		(object[property] = value),
		untrack(() => object[property]),
		property,
		location
	);
}

/**
 * @param {any} object
 * @param {string} property
 * @param {any} value
 * @param {string} location
 */
export function assign_and(object, property, value, location) {
	return compare(
		(object[property] &&= value),
		untrack(() => object[property]),
		property,
		location
	);
}

/**
 * @param {any} object
 * @param {string} property
 * @param {any} value
 * @param {string} location
 */
export function assign_or(object, property, value, location) {
	return compare(
		(object[property] ||= value),
		untrack(() => object[property]),
		property,
		location
	);
}

/**
 * @param {any} object
 * @param {string} property
 * @param {any} value
 * @param {string} location
 */
export function assign_nullish(object, property, value, location) {
	return compare(
		(object[property] ??= value),
		untrack(() => object[property]),
		property,
		location
	);
}

Domain

Subdomains

Frequently Asked Questions

What does assign.js do?
assign.js is a source file in the svelte codebase, written in javascript. It belongs to the ClientRuntime domain, Hydration subdomain.
What functions are defined in assign.js?
assign.js defines 5 function(s): assign, assign_and, assign_nullish, assign_or, compare.
What does assign.js depend on?
assign.js imports 6 module(s): constants, runtime.js, sanitize_location, untrack, utils.js, warnings.js.
Where is assign.js in the architecture?
assign.js is located at packages/svelte/src/internal/client/dev/assign.js (domain: ClientRuntime, subdomain: Hydration, directory: packages/svelte/src/internal/client/dev).

Analyze Your Own Codebase

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

Try Supermodel Free