Home / File/ _config.js — svelte Source File

_config.js — svelte Source File

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

File javascript BuildSystem QualityControl 1 imports 4 functions

Entity Profile

Dependency Diagram

graph LR
  159ce0c5_5a18_878b_0dd7_2743ffd349ac["_config.js"]
  654af6d6_2570_6860_f8dd_6b6131e1eec4["test.ts"]
  159ce0c5_5a18_878b_0dd7_2743ffd349ac --> 654af6d6_2570_6860_f8dd_6b6131e1eec4
  style 159ce0c5_5a18_878b_0dd7_2743ffd349ac fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { test } from '../../test';

const VALUES = Array.from('abcdefghijklmnopqrstuvwxyz');

/** @param {string} array */
function toObjects(array) {
	return array.split('').map((x) => ({ id: x }));
}

function permute() {
	const values = VALUES.slice();
	const number = Math.floor(Math.random() * VALUES.length);
	const permuted = [];
	for (let i = 0; i < number; i++) {
		permuted.push(...values.splice(Math.floor(Math.random() * (number - i)), 1));
	}

	return permuted.join('');
}

export default test({
	get props() {
		return { values: toObjects('abc') };
	},

	html: '(a)(b)(c)',

	test({ assert, component, target }) {
		/** @param {string} sequence */
		function test(sequence) {
			const previous = target.textContent;
			const expected = sequence
				.split('')
				.map((x) => `(${x})`)
				.join('');
			component.values = toObjects(sequence);
			assert.htmlEqual(
				target.innerHTML,
				expected,
				`\n${previous} -> ${expected}\n${target.textContent}`
			);
		}

		// first, some fixed tests so that we can debug them
		test('abc');
		test('abcd');
		test('abecd');
		test('fabecd');
		test('fabed');
		test('beadf');
		test('ghbeadf');
		test('gf');
		test('gc');
		test('g');
		test('');
		test('abc');
		test('duqbmineapjhtlofrskcg');
		test('hdnkjougmrvftewsqpailcb');
		test('bidhfacge');
		test('kgjnempcboaflidh');
		test('fekbijachgd');
		test('kdmlgfbicheja');

		// then, we party
		for (let i = 0; i < 100; i += 1) test(permute());
	}
});

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does _config.js do?
_config.js is a source file in the svelte codebase, written in javascript. It belongs to the BuildSystem domain, QualityControl subdomain.
What functions are defined in _config.js?
_config.js defines 4 function(s): default.props, default.test, permute, toObjects.
What does _config.js depend on?
_config.js imports 1 module(s): test.ts.
Where is _config.js in the architecture?
_config.js is located at packages/svelte/tests/runtime-legacy/samples/each-block-keyed-random-permute/_config.js (domain: BuildSystem, subdomain: QualityControl, directory: packages/svelte/tests/runtime-legacy/samples/each-block-keyed-random-permute).

Analyze Your Own Codebase

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

Try Supermodel Free