Home / Function/ list() — svelte Function Reference

list() — svelte Function Reference

Architecture documentation for the list() function in string.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  5439801b_d67f_6bbb_bae7_1c9abc2aa128["list()"]
  a9449a4a_d1d3_453e_353c_d48e9e730654["string.js"]
  5439801b_d67f_6bbb_bae7_1c9abc2aa128 -->|defined in| a9449a4a_d1d3_453e_353c_d48e9e730654
  be9cd3f4_bdc5_dc26_dae4_4a34e45ab7eb["element()"]
  be9cd3f4_bdc5_dc26_dae4_4a34e45ab7eb -->|calls| 5439801b_d67f_6bbb_bae7_1c9abc2aa128
  c342967b_b314_8027_476d_d085ed0e13f0["check_element()"]
  c342967b_b314_8027_476d_d085ed0e13f0 -->|calls| 5439801b_d67f_6bbb_bae7_1c9abc2aa128
  4a556532_b1f3_3bc7_3a43_4a663da1eb23["validate_aria_attribute_value()"]
  4a556532_b1f3_3bc7_3a43_4a663da1eb23 -->|calls| 5439801b_d67f_6bbb_bae7_1c9abc2aa128
  style 5439801b_d67f_6bbb_bae7_1c9abc2aa128 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/utils/string.js lines 5–9

export function list(strings, conjunction = 'or') {
	if (strings.length === 1) return strings[0];
	if (strings.length === 2) return `${strings[0]} ${conjunction} ${strings[1]}`;
	return `${strings.slice(0, -1).join(', ')} ${conjunction} ${strings[strings.length - 1]}`;
}

Domain

Subdomains

Frequently Asked Questions

What does list() do?
list() is a function in the svelte codebase, defined in packages/svelte/src/compiler/utils/string.js.
Where is list() defined?
list() is defined in packages/svelte/src/compiler/utils/string.js at line 5.
What calls list()?
list() is called by 3 function(s): check_element, element, validate_aria_attribute_value.

Analyze Your Own Codebase

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

Try Supermodel Free