MCPcopy Create free account
hub / github.com/arktypeio/arktype / cfg

Function cfg

ark/schema/scope.ts:426–443  ·  view source on GitHub ↗

its config, with defaults and global config applied

()

Source from the content-addressed store, hash-verified

424
425 /** its config, with defaults and global config applied */
426 get cfg(): ResolvedScopeConfig {
427 // the first read fixes the global config, so configure throws after it
428 const globalConfig = ($ark.cfg ??= resolveGlobalConfig($ark.defaultConfig))
429 const cfg = mergeConfigs(globalConfig, this.scopeConfig)
430 const missing: InstalledOption | undefined =
431 cfg.errors !== "all" && !$ark.errorModes ? "errors"
432 : cfg.mutatesInput && !$ark.inPlace ? "mutatesInput"
433 : undefined
434 if (missing) {
435 throwParseError(
436 writeMissingImportMessage(missing, printable(cfg[missing]))
437 )
438 }
439 // locale is global-only, though an untyped config can pass one
440 if (cfg.locale !== globalConfig.locale)
441 (cfg as { locale: Locale.Resolved }).locale = globalConfig.locale
442 return this.memo("cfg", cfg)
443 }
444
445 get intrinsic(): Omit<typeof $ark.kw, `json${string}`> {
446 // intrinsic won't be available during bootstrapping, so we lie

Callers

nothing calls this directly

Calls 6

resolveGlobalConfigFunction · 0.90
mergeConfigsFunction · 0.90
throwParseErrorFunction · 0.90
printableFunction · 0.90
memoMethod · 0.45

Tested by

no test coverage detected