LogoLogo

Schema Benchmarks

    • home
      Home

    • download_2
      Download

    • timer
      Initialization
    • check_circle
      Validation
    • output_circle
      Parsing
    • swap_horiz
      Codec
    • schema
      Standard Schema
    • data_object
      JSON Schema
    • format_quote
      String

    • error
      Stack

    • deployed_code
      Libraries

    • article
      Blog
Expand sidebarExpand sidebar
typia/Compiled (minified)Compiled (minified)
github
GitHubGitHub
DiscordDiscord
PreferencesPreferences
schemas/libraries/typia/download_compiled/minified.js
code_off
View RawView Raw
Copy to clipboardCopy to clipboard
const e = (e) => t.test(e), t = /^(?:https?|ftp):\/\/(?:[^\s/?#@]+(?::[^\s/?#@]*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?=.{1,253}(?::\d{2,5})?(?:\/[^\s]*)?$)(?:[a-z0-9\u00a1-\uffff](?:[-a-z0-9\u00a1-\uffff]{0,61}[a-z0-9\u00a1-\uffff])?\.)+(?:[a-z\u00a1-\uffff](?:[-a-z0-9\u00a1-\uffff]{0,61}[a-z0-9\u00a1-\uffff])))(?::\d{2,5})?(?:\/[^\s]*)?$/iu, n = (e) => { let t = 0; for (let n of e) ++t; return t; }, r = (e) => { let t = (e, t) => t === e || t.startsWith(`${e}.`) || t.startsWith(`${e}[`), n = (n) => { if (e.length === 0) return !0; let r = e[e.length - 1].path; return t(n, r) === !1 && t(r, n) === !1; }; return (t, r) => ( t && n(r.path) && (r.value === void 0 && (r.description ??= [ "The value at this path is `undefined`.", ``, `Please fill the \`${r.expected}\` typed value next time.`, ].join(` `)), e.push(r)), !1 ); }; (() => { let t = (e) => typeof e.id == `number`, i = (e) => e.created instanceof Date, a = (e) => typeof e.title == `string` && 1 <= n(e.title) && n(e.title) <= 100, o = (e) => Array.isArray(e.images) && e.images.every((e) => typeof e == `object` && !!e && p(e)), s = `{ id: number; created: Date; title: string & MinLength<1> & MaxLength<100>; brand: string & MinLength<1> & MaxLength<30>; description: string & ... 1 more ... & MaxLength<...>; ... 5 more ...; ratings: RatingSchema[]; }`, c = (e, t, n = !0) => typeof e.id == `number` || b(n, { path: t + `.id`, expected: `number`, value: e.id }), l = (e, t, n = !0) => e.created instanceof Date || b(n, { path: t + `.created`, expected: `Date`, value: e.created }), u = (e, t, r = !0) => (typeof e.title == `string` && (1 <= n(e.title) || b(r, { path: t + `.title`, expected: `string & MinLength<1>`, value: e.title })) && (n(e.title) <= 100 || b(r, { path: t + `.title`, expected: `string & MaxLength<100>`, value: e.title }))) || b(r, { path: t + `.title`, expected: `(string & MinLength<1> & MaxLength<100>)`, value: e.title, }), d = (e, t, n = !0) => ((Array.isArray(e.images) || b(n, { path: t + `.images`, expected: `Array<ImageSchema>`, value: e.images })) && e.images .map( (e, r) => (((typeof e == `object` && !!e) || b(n, { path: t + `.images[` + r + `]`, expected: `ImageSchema`, value: e })) && g(e, t + `.images[` + r + `]`, n)) || b(n, { path: t + `.images[` + r + `]`, expected: `ImageSchema`, value: e }), ) .every((e) => e)) || b(n, { path: t + `.images`, expected: `Array<ImageSchema>`, value: e.images }), f = (e) => t(e) && i(e) && a(e) && typeof e.brand == `string` && 1 <= n(e.brand) && n(e.brand) <= 30 && typeof e.description == `string` && 1 <= n(e.description) && n(e.description) <= 500 && typeof e.price == `number` && 1 <= e.price && e.price <= 1e4 && (e.discount === null || (typeof e.discount == `number` && 1 <= e.discount && e.discount <= 100)) && typeof e.quantity == `number` && 1 <= e.quantity && e.quantity <= 10 && Array.isArray(e.tags) && 1 <= e.tags.length && e.tags.length <= 30 && e.tags.every((e) => typeof e == `string`) && o(e) && Array.isArray(e.ratings) && e.ratings.every((e) => typeof e == `object` && !!e && m(e)), p = (n) => t(n) && i(n) && a(n) && (n.type === `jpg` || n.type === `png`) && typeof n.size == `number` && typeof n.url == `string` && e(n.url), m = (e) => t(e) && typeof e.stars == `number` && 1 <= e.stars && e.stars <= 5 && a(e) && typeof e.text == `string` && 1 <= n(e.text) && n(e.text) <= 1e3 && o(e), h = (e, t, r = !0) => [ c(e, t, r), l(e, t, r), u(e, t, r), (typeof e.brand == `string` && (1 <= n(e.brand) || b(r, { path: t + `.brand`, expected: `string & MinLength<1>`, value: e.brand })) && (n(e.brand) <= 30 || b(r, { path: t + `.brand`, expected: `string & MaxLength<30>`, value: e.brand }))) || b(r, { path: t + `.brand`, expected: `(string & MinLength<1> & MaxLength<30>)`, value: e.brand, }), (typeof e.description == `string` && (1 <= n(e.description) || b(r, { path: t + `.description`, expected: `string & MinLength<1>`, value: e.description, })) && (n(e.description) <= 500 || b(r, { path: t + `.description`, expected: `string & MaxLength<500>`, value: e.description, }))) || b(r, { path: t + `.description`, expected: `(string & MinLength<1> & MaxLength<500>)`, value: e.description, }), (typeof e.price == `number` && (1 <= e.price || b(r, { path: t + `.price`, expected: `number & Minimum<1>`, value: e.price })) && (e.price <= 1e4 || b(r, { path: t + `.price`, expected: `number & Maximum<10000>`, value: e.price }))) || b(r, { path: t + `.price`, expected: `(number & Minimum<1> & Maximum<10000>)`, value: e.price, }), e.discount === null || (typeof e.discount == `number` && (1 <= e.discount || b(r, { path: t + `.discount`, expected: `number & Minimum<1>`, value: e.discount, })) && (e.discount <= 100 || b(r, { path: t + `.discount`, expected: `number & Maximum<100>`, value: e.discount, }))) || b(r, { path: t + `.discount`, expected: `((number & Minimum<1> & Maximum<100>) | null)`, value: e.discount, }), (typeof e.quantity == `number` && (1 <= e.quantity || b(r, { path: t + `.quantity`, expected: `number & Minimum<1>`, value: e.quantity })) && (e.quantity <= 10 || b(r, { path: t + `.quantity`, expected: `number & Maximum<10>`, value: e.quantity, }))) || b(r, { path: t + `.quantity`, expected: `(number & Minimum<1> & Maximum<10>)`, value: e.quantity, }), ((Array.isArray(e.tags) || b(r, { path: t + `.tags`, expected: `(Array<string> & MinItems<1> & MaxItems<30>)`, value: e.tags, })) && (1 <= e.tags.length || b(r, { path: t + `.tags`, expected: `Array<> & MinItems<1>`, value: e.tags })) && (e.tags.length <= 30 || b(r, { path: t + `.tags`, expected: `Array<> & MaxItems<30>`, value: e.tags })) && e.tags .map( (e, n) => typeof e == `string` || b(r, { path: t + `.tags[` + n + `]`, expected: `string`, value: e }), ) .every((e) => e)) || b(r, { path: t + `.tags`, expected: `(Array<string> & MinItems<1> & MaxItems<30>)`, value: e.tags, }), d(e, t, r), ((Array.isArray(e.ratings) || b(r, { path: t + `.ratings`, expected: `Array<RatingSchema>`, value: e.ratings })) && e.ratings .map( (e, n) => (((typeof e == `object` && !!e) || b(r, { path: t + `.ratings[` + n + `]`, expected: `RatingSchema`, value: e })) && _(e, t + `.ratings[` + n + `]`, r)) || b(r, { path: t + `.ratings[` + n + `]`, expected: `RatingSchema`, value: e }), ) .every((e) => e)) || b(r, { path: t + `.ratings`, expected: `Array<RatingSchema>`, value: e.ratings }), ].every((e) => e), g = (t, n, r = !0) => [ c(t, n, r), l(t, n, r), u(t, n, r), t.type === `jpg` || t.type === `png` || b(r, { path: n + `.type`, expected: `("jpg" | "png")`, value: t.type }), typeof t.size == `number` || b(r, { path: n + `.size`, expected: `number`, value: t.size }), (typeof t.url == `string` && (e(t.url) || b(r, { path: n + `.url`, expected: `string & Format<"url">`, value: t.url }))) || b(r, { path: n + `.url`, expected: `(string & Format<"url">)`, value: t.url }), ].every((e) => e), _ = (e, t, r = !0) => [ c(e, t, r), (typeof e.stars == `number` && (1 <= e.stars || b(r, { path: t + `.stars`, expected: `number & Minimum<1>`, value: e.stars })) && (e.stars <= 5 || b(r, { path: t + `.stars`, expected: `number & Maximum<5>`, value: e.stars }))) || b(r, { path: t + `.stars`, expected: `(number & Minimum<1> & Maximum<5>)`, value: e.stars, }), u(e, t, r), (typeof e.text == `string` && (1 <= n(e.text) || b(r, { path: t + `.text`, expected: `string & MinLength<1>`, value: e.text })) && (n(e.text) <= 1e3 || b(r, { path: t + `.text`, expected: `string & MaxLength<1000>`, value: e.text }))) || b(r, { path: t + `.text`, expected: `(string & MinLength<1> & MaxLength<1000>)`, value: e.text, }), d(e, t, r), ].every((e) => e), v = (e) => typeof e == `object` && !!e && f(e), y, b; return (e) => { if (!1 === v(e)) { ((y = []), (b = r(y)), ((e, t, n = !0) => (((typeof e == `object` && !!e) || b(!0, { path: t + ``, expected: s, value: e })) && h(e, t + ``, !0)) || b(!0, { path: t + ``, expected: s, value: e }))(e, `$input`, !0)); let t = y.length === 0; return t ? { success: t, data: e } : { success: t, errors: y, data: e }; } return { success: !0, data: e }; }; })()({});
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures