Skip to content

Commit

Permalink
docs: Fix tree-shake path
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkarolyi committed Mar 10, 2022
1 parent 0dd2269 commit 446c0ec
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 43 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,6 @@ const TNumberBiggerThan10 = TValidate(
All guards can be imported as a single module, which enables tree-shaking:

```ts
import TString from "tguard/guards/TString";
import { GuardedType } from "tguard/Guard";
import TString from "tguard/lib/guards/TString";
import Guard, { GuardedType } from "tguard/lib/Guard";
```
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,6 @@ const TNumberBiggerThan10 = TValidate(
All guards can be imported as a single module, which enables tree-shaking:

```ts
import TString from "tguard/guards/TString";
import { GuardedType } from "tguard/Guard";
import TString from "tguard/lib/guards/TString";
import Guard, { GuardedType } from "tguard/lib/Guard";
```
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/d0ca035/src/Guard.ts#L11)
[src/Guard.ts:11](https://github.com/davidkarolyi/tguard/blob/0dd2269/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/d0ca035/src/Guard.ts#L13)
[src/Guard.ts:13](https://github.com/davidkarolyi/tguard/blob/0dd2269/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/d0ca035/src/Guard.ts#L12)
[src/Guard.ts:12](https://github.com/davidkarolyi/tguard/blob/0dd2269/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/d0ca035/src/errors.ts#L5)
[src/errors.ts:5](https://github.com/davidkarolyi/tguard/blob/0dd2269/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/d0ca035/src/errors.ts#L3)
[src/errors.ts:3](https://github.com/davidkarolyi/tguard/blob/0dd2269/src/errors.ts#L3)

___

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

#### Defined in

[src/errors.ts:2](https://github.com/davidkarolyi/tguard/blob/d0ca035/src/errors.ts#L2)
[src/errors.ts:2](https://github.com/davidkarolyi/tguard/blob/0dd2269/src/errors.ts#L2)

___

Expand Down
88 changes: 55 additions & 33 deletions docs/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- [TString](modules.md#tstring)
- [TStringEmail](modules.md#tstringemail)
- [TStringISODate](modules.md#tstringisodate)
- [TStringJSON](modules.md#tstringjson)
- [TStringJWT](modules.md#tstringjwt)
- [TStringMIMEType](modules.md#tstringmimetype)
- [TStringPhoneNumber](modules.md#tstringphonenumber)
Expand Down Expand Up @@ -67,7 +68,7 @@ Infers the type, that the given `Guard` guards.

#### Defined in

[src/Guard.ts:22](https://github.com/davidkarolyi/tguard/blob/d0ca035/src/Guard.ts#L22)
[src/Guard.ts:22](https://github.com/davidkarolyi/tguard/blob/0dd2269/src/Guard.ts#L22)

___

Expand All @@ -85,7 +86,7 @@ Infers the type, that the given `Schema` represents.

#### Defined in

[src/guards/TObject/types.ts:8](https://github.com/davidkarolyi/tguard/blob/d0ca035/src/guards/TObject/types.ts#L8)
[src/guards/TObject/types.ts:8](https://github.com/davidkarolyi/tguard/blob/0dd2269/src/guards/TObject/types.ts#L8)

## Variables

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

#### Defined in

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

___

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

#### Defined in

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

___

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

#### Defined in

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

___

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

#### Defined in

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

___

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

#### Defined in

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

___

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

#### Defined in

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

___

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

#### Defined in

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

___

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

#### Defined in

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

___

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

#### Defined in

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

___

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

#### Defined in

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

___

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

#### Defined in

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

___

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

#### Defined in

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

___

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

#### Defined in

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

___

### TStringJSON

`Const` **TStringJSON**: [`Guard`](classes/Guard.md)<`string`\>

A `Guard` which validates if a string is a valid JSON.

`guard.name: "string(JSON)"`

**`example`**
```ts
TStringJSON.isValid("1234"); // false
TStringJSON.isValid("{\"foo\": 2}"); // true
TStringJSON.name === "string(JSON)"; // true
```

#### Defined in

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

___

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

#### Defined in

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

___

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

#### Defined in

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

___

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

#### Defined in

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

___

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

#### Defined in

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

___

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

#### Defined in

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

___

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

#### Defined in

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

___

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

#### Defined in

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

## Functions

Expand Down Expand Up @@ -483,7 +505,7 @@ Accepts a value when it was accepted by both `guardA` and `guardB`.

#### Defined in

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

___

Expand Down Expand Up @@ -526,7 +548,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/d0ca035/src/guards/TArray/index.ts#L24)
[src/guards/TArray/index.ts:24](https://github.com/davidkarolyi/tguard/blob/0dd2269/src/guards/TArray/index.ts#L24)

___

Expand Down Expand Up @@ -569,7 +591,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/d0ca035/src/guards/TConstant/index.ts#L26)
[src/guards/TConstant/index.ts:26](https://github.com/davidkarolyi/tguard/blob/0dd2269/src/guards/TConstant/index.ts#L26)

___

Expand Down Expand Up @@ -608,7 +630,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/d0ca035/src/guards/TNot/index.ts#L21)
[src/guards/TNot/index.ts:21](https://github.com/davidkarolyi/tguard/blob/0dd2269/src/guards/TNot/index.ts#L21)

___

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

#### Defined in

[src/guards/TObject/index.ts:30](https://github.com/davidkarolyi/tguard/blob/d0ca035/src/guards/TObject/index.ts#L30)
[src/guards/TObject/index.ts:30](https://github.com/davidkarolyi/tguard/blob/0dd2269/src/guards/TObject/index.ts#L30)

___

Expand Down Expand Up @@ -714,7 +736,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/d0ca035/src/guards/TObjectOfShape/index.ts#L39)
[src/guards/TObjectOfShape/index.ts:39](https://github.com/davidkarolyi/tguard/blob/0dd2269/src/guards/TObjectOfShape/index.ts#L39)

___

Expand Down Expand Up @@ -760,7 +782,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/d0ca035/src/guards/TOr/index.ts#L22)
[src/guards/TOr/index.ts:22](https://github.com/davidkarolyi/tguard/blob/0dd2269/src/guards/TOr/index.ts#L22)

___

Expand Down Expand Up @@ -794,7 +816,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/d0ca035/src/guards/TStringBase64/index.ts#L21)
[src/guards/TStringBase64/index.ts:21](https://github.com/davidkarolyi/tguard/blob/0dd2269/src/guards/TStringBase64/index.ts#L21)

___

Expand Down Expand Up @@ -829,7 +851,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/d0ca035/src/guards/TStringMatch/index.ts#L23)
[src/guards/TStringMatch/index.ts:23](https://github.com/davidkarolyi/tguard/blob/0dd2269/src/guards/TStringMatch/index.ts#L23)

___

Expand Down Expand Up @@ -864,7 +886,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/d0ca035/src/guards/TStringWithLength/index.ts#L22)
[src/guards/TStringWithLength/index.ts:22](https://github.com/davidkarolyi/tguard/blob/0dd2269/src/guards/TStringWithLength/index.ts#L22)

___

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

#### Defined in

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

0 comments on commit 446c0ec

Please sign in to comment.