MCPcopy
hub / github.com/sveltejs/svelte / boolean

Function boolean

packages/svelte/src/compiler/validate-options.js:296–303  ·  view source on GitHub ↗

* @param {boolean | undefined} fallback * @returns {Validator}

(fallback)

Source from the content-addressed store, hash-verified

294 * @returns {Validator}
295 */
296function boolean(fallback) {
297 return validator(fallback, (input, keypath) => {
298 if (typeof input !== 'boolean') {
299 throw_error(`${keypath} should be true or false, if specified`);
300 }
301 return input;
302 });
303}
304
305/**
306 * @param {Array<boolean | string | number>} options

Callers 1

Calls 2

validatorFunction · 0.85
throw_errorFunction · 0.70

Tested by

no test coverage detected