Download .opencode/node_modules/zod/src/v4/locales/ko.ts from Chenloong999/opencode-data: direct link, hf CLI and curl.
- Browser
- Download file 4.71 kB
-
https://huggingface.co/datasets/Chenloong999/opencode-data/resolve/main/.opencode/node_modules/zod/src/v4/locales/ko.ts
- Command line
-
hf download hf://datasets/Chenloong999/opencode-data/.opencode/node_modules/zod/src/v4/locales/ko.ts
-
curl -L -o ko.ts https://huggingface.co/datasets/Chenloong999/opencode-data/resolve/main/.opencode/node_modules/zod/src/v4/locales/ko.ts
4.71 kB
| import type { $ZodStringFormats } from "../core/checks.js"; | |
| import type * as errors from "../core/errors.js"; | |
| import * as util from "../core/util.js"; | |
| const error: () => errors.$ZodErrorMap = () => { | |
| const Sizable: Record<string, { unit: string; verb: string }> = { | |
| string: { unit: "λ¬Έμ", verb: "to have" }, | |
| file: { unit: "λ°μ΄νΈ", verb: "to have" }, | |
| array: { unit: "κ°", verb: "to have" }, | |
| set: { unit: "κ°", verb: "to have" }, | |
| }; | |
| function getSizing(origin: string): { unit: string; verb: string } | null { | |
| return Sizable[origin] ?? null; | |
| } | |
| const parsedType = (data: any): string => { | |
| const t = typeof data; | |
| switch (t) { | |
| case "number": { | |
| return Number.isNaN(data) ? "NaN" : "number"; | |
| } | |
| case "object": { | |
| if (Array.isArray(data)) { | |
| return "array"; | |
| } | |
| if (data === null) { | |
| return "null"; | |
| } | |
| if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { | |
| return data.constructor.name; | |
| } | |
| } | |
| } | |
| return t; | |
| }; | |
| const Nouns: { | |
| [k in $ZodStringFormats | (string & {})]?: string; | |
| } = { | |
| regex: "μ λ ₯", | |
| email: "μ΄λ©μΌ μ£Όμ", | |
| url: "URL", | |
| emoji: "μ΄λͺ¨μ§", | |
| uuid: "UUID", | |
| uuidv4: "UUIDv4", | |
| uuidv6: "UUIDv6", | |
| nanoid: "nanoid", | |
| guid: "GUID", | |
| cuid: "cuid", | |
| cuid2: "cuid2", | |
| ulid: "ULID", | |
| xid: "XID", | |
| ksuid: "KSUID", | |
| datetime: "ISO λ μ§μκ°", | |
| date: "ISO λ μ§", | |
| time: "ISO μκ°", | |
| duration: "ISO κΈ°κ°", | |
| ipv4: "IPv4 μ£Όμ", | |
| ipv6: "IPv6 μ£Όμ", | |
| cidrv4: "IPv4 λ²μ", | |
| cidrv6: "IPv6 λ²μ", | |
| base64: "base64 μΈμ½λ© λ¬Έμμ΄", | |
| base64url: "base64url μΈμ½λ© λ¬Έμμ΄", | |
| json_string: "JSON λ¬Έμμ΄", | |
| e164: "E.164 λ²νΈ", | |
| jwt: "JWT", | |
| template_literal: "μ λ ₯", | |
| }; | |
| return (issue) => { | |
| switch (issue.code) { | |
| case "invalid_type": | |
| return `μλͺ»λ μ λ ₯: μμ νμ μ ${issue.expected}, λ°μ νμ μ ${parsedType(issue.input)}μ λλ€`; | |
| case "invalid_value": | |
| if (issue.values.length === 1) | |
| return `μλͺ»λ μ λ ₯: κ°μ ${util.stringifyPrimitive(issue.values[0])} μ΄μ΄μΌ ν©λλ€`; | |
| return `μλͺ»λ μ΅μ : ${util.joinValues(issue.values, "λλ ")} μ€ νλμ¬μΌ ν©λλ€`; | |
| case "too_big": { | |
| const adj = issue.inclusive ? "μ΄ν" : "λ―Έλ§"; | |
| const suffix = adj === "λ―Έλ§" ? "μ΄μ΄μΌ ν©λλ€" : "μ¬μΌ ν©λλ€"; | |
| const sizing = getSizing(issue.origin); | |
| const unit = sizing?.unit ?? "μμ"; | |
| if (sizing) return `${issue.origin ?? "κ°"}μ΄ λ무 ν½λλ€: ${issue.maximum.toString()}${unit} ${adj}${suffix}`; | |
| return `${issue.origin ?? "κ°"}μ΄ λ무 ν½λλ€: ${issue.maximum.toString()} ${adj}${suffix}`; | |
| } | |
| case "too_small": { | |
| const adj = issue.inclusive ? "μ΄μ" : "μ΄κ³Ό"; | |
| const suffix = adj === "μ΄μ" ? "μ΄μ΄μΌ ν©λλ€" : "μ¬μΌ ν©λλ€"; | |
| const sizing = getSizing(issue.origin); | |
| const unit = sizing?.unit ?? "μμ"; | |
| if (sizing) { | |
| return `${issue.origin ?? "κ°"}μ΄ λ무 μμ΅λλ€: ${issue.minimum.toString()}${unit} ${adj}${suffix}`; | |
| } | |
| return `${issue.origin ?? "κ°"}μ΄ λ무 μμ΅λλ€: ${issue.minimum.toString()} ${adj}${suffix}`; | |
| } | |
| case "invalid_format": { | |
| const _issue = issue as errors.$ZodStringFormatIssues; | |
| if (_issue.format === "starts_with") { | |
| return `μλͺ»λ λ¬Έμμ΄: "${_issue.prefix}"(μΌ)λ‘ μμν΄μΌ ν©λλ€`; | |
| } | |
| if (_issue.format === "ends_with") return `μλͺ»λ λ¬Έμμ΄: "${_issue.suffix}"(μΌ)λ‘ λλμΌ ν©λλ€`; | |
| if (_issue.format === "includes") return `μλͺ»λ λ¬Έμμ΄: "${_issue.includes}"μ(λ₯Ό) ν¬ν¨ν΄μΌ ν©λλ€`; | |
| if (_issue.format === "regex") return `μλͺ»λ λ¬Έμμ΄: μ κ·μ ${_issue.pattern} ν¨ν΄κ³Ό μΌμΉν΄μΌ ν©λλ€`; | |
| return `μλͺ»λ ${Nouns[_issue.format] ?? issue.format}`; | |
| } | |
| case "not_multiple_of": | |
| return `μλͺ»λ μ«μ: ${issue.divisor}μ λ°°μμ¬μΌ ν©λλ€`; | |
| case "unrecognized_keys": | |
| return `μΈμν μ μλ ν€: ${util.joinValues(issue.keys, ", ")}`; | |
| case "invalid_key": | |
| return `μλͺ»λ ν€: ${issue.origin}`; | |
| case "invalid_union": | |
| return `μλͺ»λ μ λ ₯`; | |
| case "invalid_element": | |
| return `μλͺ»λ κ°: ${issue.origin}`; | |
| default: | |
| return `μλͺ»λ μ λ ₯`; | |
| } | |
| }; | |
| }; | |
| export default function (): { localeError: errors.$ZodErrorMap } { | |
| return { | |
| localeError: error(), | |
| }; | |
| } | |