Skip to content

Commit

Permalink
docs: Fix TValidate example
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkarolyi committed Mar 11, 2022
1 parent f2e7a9f commit 458c9b2
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ You can define any custom Guard with [`TValidate`](/docs/modules.md#tvalidate).
Defining a guard that validates if a number is bigger than 10:

```ts
const TNumberBiggerThan10 = TValidate(
const TNumberBiggerThan10 = TValidate<number>(
"number(bigger than 10)",
(value) => typeof value === "number" && value > 10
);
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ You can define any custom Guard with [`TValidate`](/docs/modules.md#tvalidate).
Defining a guard that validates if a number is bigger than 10:

```ts
const TNumberBiggerThan10 = TValidate(
const TNumberBiggerThan10 = TValidate<number>(
"number(bigger than 10)",
(value) => typeof value === "number" && value > 10
);
Expand Down
6 changes: 3 additions & 3 deletions docs/classes/Guard.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ An abstract class, which is the parent class of all Guards. (Names starting with

#### Defined in

[src/Guard.ts:11](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/Guard.ts#L11)
[src/Guard.ts:11](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/Guard.ts#L11)

## Methods

Expand All @@ -67,7 +67,7 @@ An abstract class, which is the parent class of all Guards. (Names starting with

#### Defined in

[src/Guard.ts:13](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/Guard.ts#L13)
[src/Guard.ts:13](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/Guard.ts#L13)

___

Expand All @@ -87,4 +87,4 @@ value is T

#### Defined in

[src/Guard.ts:12](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/Guard.ts#L12)
[src/Guard.ts:12](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/Guard.ts#L12)
6 changes: 3 additions & 3 deletions docs/classes/ValidationError.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Error.constructor

#### Defined in

[src/errors.ts:5](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/errors.ts#L5)
[src/errors.ts:5](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/errors.ts#L5)

## Properties

Expand All @@ -58,7 +58,7 @@ Error.constructor

#### Defined in

[src/errors.ts:3](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/errors.ts#L3)
[src/errors.ts:3](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/errors.ts#L3)

___

Expand Down Expand Up @@ -96,7 +96,7 @@ ___

#### Defined in

[src/errors.ts:2](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/errors.ts#L2)
[src/errors.ts:2](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/errors.ts#L2)

___

Expand Down
68 changes: 34 additions & 34 deletions docs/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Infers the type, that the given `Guard` guards.

#### Defined in

[src/Guard.ts:22](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/Guard.ts#L22)
[src/Guard.ts:22](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/Guard.ts#L22)

___

Expand All @@ -82,7 +82,7 @@ ___

#### Defined in

[src/guards/TObject/types.ts:16](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TObject/types.ts#L16)
[src/guards/TObject/types.ts:16](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TObject/types.ts#L16)

## Variables

Expand All @@ -96,7 +96,7 @@ Guard that accepts any value.

#### Defined in

[src/guards/TAny/index.ts:8](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TAny/index.ts#L8)
[src/guards/TAny/index.ts:8](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TAny/index.ts#L8)

___

Expand All @@ -111,7 +111,7 @@ Does not accept null.

#### Defined in

[src/guards/TAnyObject/index.ts:9](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TAnyObject/index.ts#L9)
[src/guards/TAnyObject/index.ts:9](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TAnyObject/index.ts#L9)

___

Expand All @@ -125,7 +125,7 @@ Primitive guard that only accepts `bigint` values.

#### Defined in

[src/guards/TBigInt/index.ts:8](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TBigInt/index.ts#L8)
[src/guards/TBigInt/index.ts:8](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TBigInt/index.ts#L8)

___

Expand All @@ -139,7 +139,7 @@ Primitive guard that only accepts `boolean` values.

#### Defined in

[src/guards/TBoolean/index.ts:8](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TBoolean/index.ts#L8)
[src/guards/TBoolean/index.ts:8](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TBoolean/index.ts#L8)

___

Expand All @@ -153,7 +153,7 @@ Primitive guard that only accepts `function` values.

#### Defined in

[src/guards/TFunction/index.ts:8](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TFunction/index.ts#L8)
[src/guards/TFunction/index.ts:8](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TFunction/index.ts#L8)

___

Expand All @@ -174,7 +174,7 @@ TInteger.isValid(15); // true

#### Defined in

[src/guards/TInteger/index.ts:15](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TInteger/index.ts#L15)
[src/guards/TInteger/index.ts:15](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TInteger/index.ts#L15)

___

Expand All @@ -195,7 +195,7 @@ TIntegerAsString.isValid("15"); // true

#### Defined in

[src/guards/TIntegerAsString/index.ts:16](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TIntegerAsString/index.ts#L16)
[src/guards/TIntegerAsString/index.ts:16](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TIntegerAsString/index.ts#L16)

___

Expand All @@ -209,7 +209,7 @@ Guard that only accepts `null`.

#### Defined in

[src/guards/TNull/index.ts:8](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TNull/index.ts#L8)
[src/guards/TNull/index.ts:8](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TNull/index.ts#L8)

___

Expand All @@ -224,7 +224,7 @@ Not accepts `NaN`.

#### Defined in

[src/guards/TNumber/index.ts:9](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TNumber/index.ts#L9)
[src/guards/TNumber/index.ts:9](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TNumber/index.ts#L9)

___

Expand All @@ -245,7 +245,7 @@ TNumberAsString.isValid("15.223"); // true

#### Defined in

[src/guards/TNumberAsString/index.ts:15](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TNumberAsString/index.ts#L15)
[src/guards/TNumberAsString/index.ts:15](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TNumberAsString/index.ts#L15)

___

Expand All @@ -259,7 +259,7 @@ Primitive guard that only accepts `string` values.

#### Defined in

[src/guards/TString/index.ts:8](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TString/index.ts#L8)
[src/guards/TString/index.ts:8](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TString/index.ts#L8)

___

Expand All @@ -280,7 +280,7 @@ TStringEmail.name === "string(email)"; // true

#### Defined in

[src/guards/TStringEmail/index.ts:16](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TStringEmail/index.ts#L16)
[src/guards/TStringEmail/index.ts:16](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TStringEmail/index.ts#L16)

___

Expand All @@ -301,7 +301,7 @@ TStringISODate.name === "string(date)"; // true

#### Defined in

[src/guards/TStringISODate/index.ts:16](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TStringISODate/index.ts#L16)
[src/guards/TStringISODate/index.ts:16](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TStringISODate/index.ts#L16)

___

Expand All @@ -322,7 +322,7 @@ TStringJSON.name === "string(JSON)"; // true

#### Defined in

[src/guards/TStringJSON/index.ts:16](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TStringJSON/index.ts#L16)
[src/guards/TStringJSON/index.ts:16](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TStringJSON/index.ts#L16)

___

Expand All @@ -343,7 +343,7 @@ TStringJWT.name === "string(JSON)"; // true

#### Defined in

[src/guards/TStringJWT/index.ts:16](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TStringJWT/index.ts#L16)
[src/guards/TStringJWT/index.ts:16](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TStringJWT/index.ts#L16)

___

Expand All @@ -364,7 +364,7 @@ TStringMIMEType.name === "string(MIME type)"; // true

#### Defined in

[src/guards/TStringMIMEType/index.ts:16](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TStringMIMEType/index.ts#L16)
[src/guards/TStringMIMEType/index.ts:16](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TStringMIMEType/index.ts#L16)

___

Expand All @@ -386,7 +386,7 @@ TStringPhoneNumber.name === "string(phone number)"; // true

#### Defined in

[src/guards/TStringPhoneNumber/index.ts:17](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TStringPhoneNumber/index.ts#L17)
[src/guards/TStringPhoneNumber/index.ts:17](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TStringPhoneNumber/index.ts#L17)

___

Expand All @@ -407,7 +407,7 @@ TStringSemVer.name === "string(SemVer)"; // true

#### Defined in

[src/guards/TStringSemVer/index.ts:16](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TStringSemVer/index.ts#L16)
[src/guards/TStringSemVer/index.ts:16](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TStringSemVer/index.ts#L16)

___

Expand All @@ -428,7 +428,7 @@ TStringURL.name === "string(URL)"; // true

#### Defined in

[src/guards/TStringURL/index.ts:16](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TStringURL/index.ts#L16)
[src/guards/TStringURL/index.ts:16](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TStringURL/index.ts#L16)

___

Expand All @@ -452,7 +452,7 @@ TStringUUID.name === "string(UUID)"; // true

#### Defined in

[src/guards/TStringUUID/index.ts:19](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TStringUUID/index.ts#L19)
[src/guards/TStringUUID/index.ts:19](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TStringUUID/index.ts#L19)

___

Expand All @@ -466,7 +466,7 @@ Primitive guard that only accepts `undefined` values.

#### Defined in

[src/guards/TUndefined/index.ts:8](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TUndefined/index.ts#L8)
[src/guards/TUndefined/index.ts:8](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TUndefined/index.ts#L8)

## Functions

Expand Down Expand Up @@ -503,7 +503,7 @@ Accepts a value when it was accepted by all `guardA` and `guardB`, and others.

#### Defined in

[src/guards/TAnd/index.ts:14](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TAnd/index.ts#L14)
[src/guards/TAnd/index.ts:14](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TAnd/index.ts#L14)

___

Expand Down Expand Up @@ -546,7 +546,7 @@ A `Guard` that checks if the given value is an array of the given type.

#### Defined in

[src/guards/TArray/index.ts:24](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TArray/index.ts#L24)
[src/guards/TArray/index.ts:24](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TArray/index.ts#L24)

___

Expand Down Expand Up @@ -589,7 +589,7 @@ A `Guard` which checks if the given value is equals to the `constant` literal.

#### Defined in

[src/guards/TConstant/index.ts:26](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TConstant/index.ts#L26)
[src/guards/TConstant/index.ts:26](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TConstant/index.ts#L26)

___

Expand Down Expand Up @@ -628,7 +628,7 @@ A `Guard` that accepts a value when it was **not** accepted by the given guard.

#### Defined in

[src/guards/TNot/index.ts:21](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TNot/index.ts#L21)
[src/guards/TNot/index.ts:21](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TNot/index.ts#L21)

___

Expand Down Expand Up @@ -676,7 +676,7 @@ A `Guard`.

#### Defined in

[src/guards/TObject/index.ts:31](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TObject/index.ts#L31)
[src/guards/TObject/index.ts:31](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TObject/index.ts#L31)

___

Expand Down Expand Up @@ -734,7 +734,7 @@ Similar in concept as TypeScript's `{[keys: string]: number}` type annotations.

#### Defined in

[src/guards/TObjectOfShape/index.ts:39](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TObjectOfShape/index.ts#L39)
[src/guards/TObjectOfShape/index.ts:39](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TObjectOfShape/index.ts#L39)

___

Expand Down Expand Up @@ -780,7 +780,7 @@ Accepts a value when it was accepted by at least one of the `guards`.

#### Defined in

[src/guards/TOr/index.ts:22](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TOr/index.ts#L22)
[src/guards/TOr/index.ts:22](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TOr/index.ts#L22)

___

Expand Down Expand Up @@ -814,7 +814,7 @@ A `Guard` that accepts only strings that are base64 encoded.

#### Defined in

[src/guards/TStringBase64/index.ts:21](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TStringBase64/index.ts#L21)
[src/guards/TStringBase64/index.ts:21](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TStringBase64/index.ts#L21)

___

Expand Down Expand Up @@ -849,7 +849,7 @@ A `Guard` that accepts only strings that matches the given `regexp`.

#### Defined in

[src/guards/TStringMatch/index.ts:23](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TStringMatch/index.ts#L23)
[src/guards/TStringMatch/index.ts:23](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TStringMatch/index.ts#L23)

___

Expand Down Expand Up @@ -884,7 +884,7 @@ A `Guard` that accepts only strings, that is in the given length range.

#### Defined in

[src/guards/TStringWithLength/index.ts:22](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TStringWithLength/index.ts#L22)
[src/guards/TStringWithLength/index.ts:22](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TStringWithLength/index.ts#L22)

___

Expand Down Expand Up @@ -922,4 +922,4 @@ const TBiggerThan10 = TValidate<number>(

#### Defined in

[src/guards/TValidate/index.ts:22](https://github.com/davidkarolyi/tguard/blob/d84cda9/src/guards/TValidate/index.ts#L22)
[src/guards/TValidate/index.ts:22](https://github.com/davidkarolyi/tguard/blob/f2e7a9f/src/guards/TValidate/index.ts#L22)

0 comments on commit 458c9b2

Please sign in to comment.