From 70226ee206aa9d795caf86b40e481d77a81d6d88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20=C3=98sterkilde?= Date: Sat, 12 Oct 2024 22:41:31 +0200 Subject: [PATCH] chore(docs): cleanup docs --- apps/docs/pages/modifiers/custom.mdx | 1 + apps/docs/pages/modifiers/max.mdx | 16 +++++++++++++++- apps/docs/pages/modifiers/min.mdx | 16 +++++++++++++++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/apps/docs/pages/modifiers/custom.mdx b/apps/docs/pages/modifiers/custom.mdx index afb080a..a0648a6 100644 --- a/apps/docs/pages/modifiers/custom.mdx +++ b/apps/docs/pages/modifiers/custom.mdx @@ -11,6 +11,7 @@ If you have specific needs that are not met by existing modifiers, the `custom` - `number`: [Learn more](/schemas/number). - `regex`: [Learn more](/schemas/regex). - `string`: [Learn more](/schemas/string). +- `array`: [Learn more](/schemas/array). ## Arguments diff --git a/apps/docs/pages/modifiers/max.mdx b/apps/docs/pages/modifiers/max.mdx index 6d66dd5..19921e7 100644 --- a/apps/docs/pages/modifiers/max.mdx +++ b/apps/docs/pages/modifiers/max.mdx @@ -18,7 +18,7 @@ A modifier which creates a validation rule to ensure that a given value is less import { Tabs, Tab } from 'nextra/components' - + ```ts import { max, number } from '@nordic-ui/validathor'; @@ -61,4 +61,18 @@ import { Tabs, Tab } from 'nextra/components' } ``` + + ```ts + import { max, array } from '@nordic-ui/validathor'; + + const schema = array([max(3)]); + + try { + const parsedValue = schema.parse([1, 2]); + console.log('Parsed value:', parsedValue); + } catch (error) { + console.error('Parsing failed:', error.message); + } + ``` + \ No newline at end of file diff --git a/apps/docs/pages/modifiers/min.mdx b/apps/docs/pages/modifiers/min.mdx index f385012..181b37b 100644 --- a/apps/docs/pages/modifiers/min.mdx +++ b/apps/docs/pages/modifiers/min.mdx @@ -18,7 +18,7 @@ A modifier which creates a validation rule to ensure that a given value is longe import { Tabs, Tab } from 'nextra/components' - + ```ts import { min, number } from '@nordic-ui/validathor'; @@ -61,4 +61,18 @@ import { Tabs, Tab } from 'nextra/components' } ``` + + ```ts + import { min, array } from '@nordic-ui/validathor'; + + const schema = array([min(3)]); + + try { + const parsedValue = schema.parse(1, 2, 3, 4); + console.log('Parsed value:', parsedValue); + } catch (error) { + console.error('Parsing failed:', error.message); + } + ``` + \ No newline at end of file