Commit Graph

1855 Commits

Author SHA1 Message Date
Luca De Santis
7d40ba5893
feat(#2059): z.string.ip() - add support for IP address (#2066)
* Add base implementation of string ip validation

For now check only IPv4

* Add IP version

If the version is not defined, the check goes
for a valid IP whether it is version 4 or 6

* Add IP in docs

* Implement IPv6 validation

* Use errToObj and update readme

---------

Co-authored-by: Colin McDonnell <colinmcd94@gmail.com>
2023-02-26 13:15:44 -08:00
Luca De Santis
5ec98e1c44
Fix email issues in pull request #1982 (#2058)
* Invalidate emails with '.' next to another

* More validation in IPv4 domain

In a valid IPv4 the numbers must go from 0 to 255

* Add IPv6 domain in email validation

* Save selected theme in localStorage
2023-02-26 13:08:44 -08:00
Hiroshiba
8f3d0283ba
BRAND Record to Non Partial (#2097) 2023-02-26 13:05:20 -08:00
Colin McDonnell
a7c2969b91 Update error_handling 2023-02-26 12:40:25 -08:00
Jacob Weisenburger
981af6503e
Merge pull request #2019 from vbud/patch-1
fix typo in readme
2023-02-19 14:29:19 -06:00
Jacob Weisenburger
654f52969a
Merge pull request #2057 from trygveaa/add-documentation-for-z-custom-params
Add documentation for the param parameter of z.custom
2023-02-19 14:26:29 -06:00
Trygve Aaberge
5cec1871ac Add documentation for the param parameter of z.custom 2023-02-18 14:57:28 +01:00
Karl Horky
9b7dd816e9
Improve variable name clarity (#2048) 2023-02-16 14:37:32 -08:00
Colin McDonnell
d8f07bbfff Fix emoji 2023-02-16 13:49:26 -08:00
Colin McDonnell
39cbb6971c Fix emoji validation, fix lint 2023-02-16 12:48:44 -08:00
Joseph Lozano
c244fb6c57
feat: z.string().emoji() (#2045)
* z.string().emoji()

* test emojis mixed with other chars
2023-02-15 23:56:59 -08:00
Valjean Clark
3c54461d7a
fix typo in readme 2023-02-09 09:01:34 -08:00
Colin McDonnell
e6939195fb 3.20.6 2023-02-09 01:13:59 -08:00
Colin McDonnell
e71c7be15e Fix extract/exclude type error 2023-02-08 11:48:32 -08:00
Colin McDonnell
c8ce27e8c0 3.20.4 2023-02-08 11:32:40 -08:00
Colin McDonnell
06c237c29f Revert merge changes 2023-02-08 11:31:10 -08:00
Colin McDonnell
b8d731f779 Set input type of ZodCatch to unknown 2023-02-08 00:07:20 -08:00
Colin McDonnell
fee81caea0 v3.20.3 2023-02-08 00:01:28 -08:00
Colin McDonnell
2c35512102 Tweak readme 2023-02-08 00:01:23 -08:00
Colin McDonnell
976f509d0a Commit 2023-02-08 00:00:43 -08:00
Pontus Fagerström
767ab1b012
test: additional unit-tests for object (#1729)
* test: add unit-tests covering object extend method

* test: add explicit testing of shape method

* Fix lint

---------

Co-authored-by: Colin McDonnell <colinmcd@alum.mit.edu>
Co-authored-by: Colin McDonnell <colinmcd94@gmail.com>
2023-02-07 23:50:42 -08:00
Luca De Santis
1e5b29e1e1
fix[#1979]: Increment Email validation (#1982)
* Increment email validation

Supported:
   - local-part -> Dot-string / Quoted-string
   - domain -> latin letters, numbers, "-" / IPv4 address
Unsupported:
   - domain -> IPv6

* Fix import type in some test files

The error generated is:
   TS2307: Cannot find module '@jest/globals' or
	its corresponding type declarations.

* Format code with prettier config

* Add more IPv4 test

* Add Invalid IPv4 tests

* Fix tests

* Lint fix

---------

Co-authored-by: Colin McDonnell <colinmcd94@gmail.com>
Co-authored-by: Colin McDonnell <colinmcd@alum.mit.edu>
2023-02-07 23:48:42 -08:00
Marco Santos
37d83e81f6
feat: Add extract/exclude methods to ZodEnum (#1652)
* Add extract/exclude to ZodEnum

* Add specs for extract/exclude

* Fix types that were failing build

* Add test to extract exclude

---------

Co-authored-by: santosmarco <eu@marco.rio.br>
2023-02-07 23:41:42 -08:00
Landon Yarrington
1e74925c36
docs: punctuation (#1973)
* docs: punctuation

* Tweaks

---------

Co-authored-by: Colin McDonnell <colinmcd@alum.mit.edu>
2023-02-07 23:31:33 -08:00
Igal Klebanov
1a033b2b74
deny unexpected keys @ ZodObject's .omit(mask),.pick(mask),.required(mask) & .partial(mask) at compile time. (#1564)
* deny unexpected keys @ `ZodObject.omit(...)` & `ZodObject.pick(...)`.

* make runtime unit tests ignore unexpected key ts error.

* forgot to run yarn build:deno.

* apply same restrictions for `required(...)` & `partial(...)` masks.

* add "non existent key" tests @ partials & pickomit.

* Naming tweak

---------

Co-authored-by: Colin McDonnell <colinmcd@alum.mit.edu>
Co-authored-by: Colin McDonnell <colinmcd94@gmail.com>
2023-02-07 23:29:45 -08:00
Max Arturo AS
17c892ada0
fix: failing prettier checks (#1969) 2023-02-07 23:06:37 -08:00
Igal Klebanov
8fcdcd651f
fix: make sure only mask keys with truthy values are respected at runtime @ .pick, .omit, .partial & .required. (#1875)
* make sure only mask keys with truthy value are respected at runtime.

* ignore falsy values test cases for `.partial(mask)` & `.required(mask)`.

Co-authored-by: Max Arturo <5713763+maxArturo@users.noreply.github.com>

* fix prettier error @ benchmarks primitives.

---------

Co-authored-by: Max Arturo <5713763+maxArturo@users.noreply.github.com>
2023-02-07 23:06:24 -08:00
Jacob Weisenburger
e4b9ac882a Merge pull request #1999 from crutchcorn/master
Add React form validation library to ecosystem
2023-02-07 16:01:47 -06:00
Jacob Weisenburger
6790212957
Merge pull request #2007 from andresBobsled/export-email-regex
export the email regex
2023-02-07 16:01:06 -06:00
Andres Taraciuk
ccfbcf8293 export the email regex 2023-02-07 17:11:00 -03:00
Corbin Crutchley
79e6d09014 Add React form validation library to ecosystem 2023-02-06 22:00:23 -08:00
Pontus Fagerström
a57fc2da3c
test: add benchmark tests for date and symbol (#1796)
* test: add benchmark for date and symbol

* test: fix lint
2023-01-29 15:59:44 -08:00
Colin McDonnell
2cea6e584f Fix test 2023-01-29 15:49:02 -08:00
Colin McDonnell
e1715574d8 Remove logging 2023-01-29 15:48:48 -08:00
Colin McDonnell
5b1940916a Clean up types 2023-01-29 15:48:48 -08:00
Colin McDonnell
2c134d89a1 Simplify ZodObject generic 2023-01-29 15:48:48 -08:00
Vu Van Dung
cdf497bba5
add z.string().cuid2() validation (#1813)
Signed-off-by: Vu Van Dung <me@joulev.dev>
2023-01-29 15:46:02 -08:00
Brian Olencki
bb7e3c29bf
Feature/add resolves method to zod promise (#1871)
* Add resolves method to ZodPromise

* Rename to unwrap

---------

Co-authored-by: Colin McDonnell <colinmcd@alum.mit.edu>
2023-01-29 15:45:35 -08:00
Rafał Witczak
bd1be4abee
Allow also "[+-]hh" as datetime offset (#1797) 2023-01-29 15:39:01 -08:00
Luca De Santis
2bca607097
fix: [#1784] dark mode in the documentation (#1932)
* Add dark theme in docs

* Add button for switch theme

* Uncomment google script

I commented that script for a test and I forgot
to uncomment it

* Clean up design

---------

Co-authored-by: Colin McDonnell <colinmcd@alum.mit.edu>
2023-01-29 14:58:45 -08:00
Max Arturo AS
296d708d32
fix: [#1839] remove caught errors from issues (#1926)
* fix: [#1839] remove caught errors from issues

* Generalize implementation

---------

Co-authored-by: Colin McDonnell <colinmcd@alum.mit.edu>
2023-01-29 14:19:32 -08:00
Mitch Winkel-Davis
e57b7ae207
chore(documentation): Update CHANGELOG to redirect to Github Releases (#1936)
The CHANGELOG is significantly out of date, and it seems release notes are now stored in Github Releases only. 
This change adds a brief message to redirect users to Github Releases.
2023-01-29 12:44:04 -08:00
Jacob Weisenburger
42984bf92b
Merge pull request #1945 from iamchandru6470/patch-1
Minor typo fix
2023-01-27 07:00:31 -06:00
Chandra Shekar
c8cb936989 fix(typo): changing from 'allows' to 'allow' 2023-01-27 18:29:08 +05:30
Chandra Shekar
ee659409b3 minor typo fix 2023-01-27 18:12:19 +05:30
Jacob Weisenburger
2e6453f8be
added Utilities for Zod to Ecosystem 2023-01-19 15:45:21 -06:00
Jacob Weisenburger
4ccecaf805
added thanks to crasite 2023-01-19 09:04:18 -06:00
Jacob Weisenburger
4fc426ccfb
added thanks to marcus13371337 and JoelBeeldi 2023-01-19 09:00:17 -06:00
Jacob Weisenburger
4fd84cda0c
added ZodType with ZodEffects to the Recursive types section 2023-01-19 08:51:00 -06:00
Jacob Weisenburger
566263f879
fixes #1901 2023-01-18 12:01:27 -06:00