Buckets:
| ; | |
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | |
| if (k2 === undefined) k2 = k; | |
| var desc = Object.getOwnPropertyDescriptor(m, k); | |
| if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | |
| desc = { enumerable: true, get: function() { return m[k]; } }; | |
| } | |
| Object.defineProperty(o, k2, desc); | |
| }) : (function(o, m, k, k2) { | |
| if (k2 === undefined) k2 = k; | |
| o[k2] = m[k]; | |
| })); | |
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | |
| Object.defineProperty(o, "default", { enumerable: true, value: v }); | |
| }) : function(o, v) { | |
| o["default"] = v; | |
| }); | |
| var __importStar = (this && this.__importStar) || function (mod) { | |
| if (mod && mod.__esModule) return mod; | |
| var result = {}; | |
| if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | |
| __setModuleDefault(result, mod); | |
| return result; | |
| }; | |
| Object.defineProperty(exports, "__esModule", { value: true }); | |
| exports.default = default_1; | |
| const util = __importStar(require("../core/util.cjs")); | |
| const error = () => { | |
| const Sizable = { | |
| string: { unit: "tegn", verb: "havde" }, | |
| file: { unit: "bytes", verb: "havde" }, | |
| array: { unit: "elementer", verb: "indeholdt" }, | |
| set: { unit: "elementer", verb: "indeholdt" }, | |
| }; | |
| const TypeNames = { | |
| string: "streng", | |
| number: "tal", | |
| boolean: "boolean", | |
| array: "liste", | |
| object: "objekt", | |
| set: "sæt", | |
| file: "fil", | |
| }; | |
| function getSizing(origin) { | |
| return Sizable[origin] ?? null; | |
| } | |
| function getTypeName(type) { | |
| return TypeNames[type] ?? type; | |
| } | |
| const parsedType = (data) => { | |
| const t = typeof data; | |
| switch (t) { | |
| case "number": { | |
| return Number.isNaN(data) ? "NaN" : "tal"; | |
| } | |
| case "object": { | |
| if (Array.isArray(data)) { | |
| return "liste"; | |
| } | |
| if (data === null) { | |
| return "null"; | |
| } | |
| if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) { | |
| return data.constructor.name; | |
| } | |
| return "objekt"; | |
| } | |
| } | |
| return t; | |
| }; | |
| const Nouns = { | |
| regex: "input", | |
| email: "e-mailadresse", | |
| url: "URL", | |
| emoji: "emoji", | |
| uuid: "UUID", | |
| uuidv4: "UUIDv4", | |
| uuidv6: "UUIDv6", | |
| nanoid: "nanoid", | |
| guid: "GUID", | |
| cuid: "cuid", | |
| cuid2: "cuid2", | |
| ulid: "ULID", | |
| xid: "XID", | |
| ksuid: "KSUID", | |
| datetime: "ISO dato- og klokkeslæt", | |
| date: "ISO-dato", | |
| time: "ISO-klokkeslæt", | |
| duration: "ISO-varighed", | |
| ipv4: "IPv4-område", | |
| ipv6: "IPv6-område", | |
| cidrv4: "IPv4-spektrum", | |
| cidrv6: "IPv6-spektrum", | |
| base64: "base64-kodet streng", | |
| base64url: "base64url-kodet streng", | |
| json_string: "JSON-streng", | |
| e164: "E.164-nummer", | |
| jwt: "JWT", | |
| template_literal: "input", | |
| }; | |
| return (issue) => { | |
| switch (issue.code) { | |
| case "invalid_type": | |
| return `Ugyldigt input: forventede ${getTypeName(issue.expected)}, fik ${getTypeName(parsedType(issue.input))}`; | |
| case "invalid_value": | |
| if (issue.values.length === 1) | |
| return `Ugyldig værdi: forventede ${util.stringifyPrimitive(issue.values[0])}`; | |
| return `Ugyldigt valg: forventede en af følgende ${util.joinValues(issue.values, "|")}`; | |
| case "too_big": { | |
| const adj = issue.inclusive ? "<=" : "<"; | |
| const sizing = getSizing(issue.origin); | |
| const origin = getTypeName(issue.origin); | |
| if (sizing) | |
| return `For stor: forventede ${origin ?? "value"} ${sizing.verb} ${adj} ${issue.maximum.toString()} ${sizing.unit ?? "elementer"}`; | |
| return `For stor: forventede ${origin ?? "value"} havde ${adj} ${issue.maximum.toString()}`; | |
| } | |
| case "too_small": { | |
| const adj = issue.inclusive ? ">=" : ">"; | |
| const sizing = getSizing(issue.origin); | |
| const origin = getTypeName(issue.origin); | |
| if (sizing) { | |
| return `For lille: forventede ${origin} ${sizing.verb} ${adj} ${issue.minimum.toString()} ${sizing.unit}`; | |
| } | |
| return `For lille: forventede ${origin} havde ${adj} ${issue.minimum.toString()}`; | |
| } | |
| case "invalid_format": { | |
| const _issue = issue; | |
| if (_issue.format === "starts_with") | |
| return `Ugyldig streng: skal starte med "${_issue.prefix}"`; | |
| if (_issue.format === "ends_with") | |
| return `Ugyldig streng: skal ende med "${_issue.suffix}"`; | |
| if (_issue.format === "includes") | |
| return `Ugyldig streng: skal indeholde "${_issue.includes}"`; | |
| if (_issue.format === "regex") | |
| return `Ugyldig streng: skal matche mønsteret ${_issue.pattern}`; | |
| return `Ugyldig ${Nouns[_issue.format] ?? issue.format}`; | |
| } | |
| case "not_multiple_of": | |
| return `Ugyldigt tal: skal være deleligt med ${issue.divisor}`; | |
| case "unrecognized_keys": | |
| return `${issue.keys.length > 1 ? "Ukendte nøgler" : "Ukendt nøgle"}: ${util.joinValues(issue.keys, ", ")}`; | |
| case "invalid_key": | |
| return `Ugyldig nøgle i ${issue.origin}`; | |
| case "invalid_union": | |
| return "Ugyldigt input: matcher ingen af de tilladte typer"; | |
| case "invalid_element": | |
| return `Ugyldig værdi i ${issue.origin}`; | |
| default: | |
| return `Ugyldigt input`; | |
| } | |
| }; | |
| }; | |
| function default_1() { | |
| return { | |
| localeError: error(), | |
| }; | |
| } | |
| module.exports = exports.default; | |
Xet Storage Details
- Size:
- 6.25 kB
- Xet hash:
- 59ff4b5ee7994df4847094244607808d37b0607b1b963b8b35dc223b6df2c277
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.