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

Function resolveLocale

ark/schema/shared/errors.ts:1446–1450  ·  view source on GitHub ↗
(locale: Locale<string>)

Source from the content-addressed store, hash-verified

1444// a locale passed to write errors in, which without arktype/i18n is only
1445// written in if it's the configured one, as writtenIn checks
1446const resolveLocale = (locale: Locale<string>): Locale.Resolved => {
1447 if (typeof locale !== "object" || locale === null || Array.isArray(locale))
1448 throwParseError(writeInvalidLocaleObjectMessage(locale))
1449 return renderer ? renderer.normalize(locale) : (locale as Locale.Resolved)
1450}
1451
1452export const writeInvalidLocaleObjectMessage = (locale: unknown): string =>
1453 `Expected a Locale object like \`de\` from "arktype/locales/de" (was ${printable(locale)})`

Callers 2

summaryInMethod · 0.85
messageInFunction · 0.85

Calls 2

throwParseErrorFunction · 0.90

Tested by

no test coverage detected