parseBigInt()
ts
function parseBigInt(data): ParseFailure | ParseSuccess<bigint>
Parse bigint
Parameters
Parameter | Type | Description |
---|---|---|
data | unknown | data to be validated |
Returns
ParseFailure
| ParseSuccess
<bigint
>
Examples
ts
parseBigInt(0n) // => ParseSuccess<bigint>
ts
parseBigInt(0) // => ParseFailure
parseBoolean()
ts
function parseBoolean(data): ParseFailure | ParseSuccess<boolean>
Parse boolean
Parameters
Parameter | Type | Description |
---|---|---|
data | unknown | data to be validated |
Returns
ParseFailure
| ParseSuccess
<boolean
>
Examples
ts
parseBoolean(true) // => ParseSuccess<boolean>
ts
parseBoolean(false) // => ParseSuccess<boolean>
ts
parseBoolean(0) // => ParseFailure
parseNull()
ts
function parseNull(data): ParseFailure | ParseSuccess<null>
Parse null
Parameters
Parameter | Type | Description |
---|---|---|
data | unknown | data to be validated |
Returns
ParseFailure
| ParseSuccess
<null
>
Examples
ts
parseNull(null) // => ParseSuccess<null>
ts
parseNull(undefined) // => ParseFailure
parseNumber()
ts
function parseNumber(data): ParseFailure | ParseSuccess<number>
Parse number
Parameters
Parameter | Type | Description |
---|---|---|
data | unknown | data to be validated |
Returns
ParseFailure
| ParseSuccess
<number
>
Examples
ts
parseNumber(0) // => ParseSuccess<number>
ts
parseNumber('0') // => ParseFailure
parseString()
ts
function parseString(data): ParseFailure | ParseSuccess<string>
Parse string
Parameters
Parameter | Type | Description |
---|---|---|
data | unknown | data to be validated |
Returns
ParseFailure
| ParseSuccess
<string
>
Examples
ts
parseString('abc') // => ParseSuccess<string>
ts
parseString(0) // => ParseFailure
parseSymbol()
ts
function parseSymbol(data): ParseFailure | ParseSuccess<symbol>
Parse symbol
Parameters
Parameter | Type | Description |
---|---|---|
data | unknown | data to be validated |
Returns
ParseFailure
| ParseSuccess
<symbol
>
Examples
ts
parseSymbol(Symbol('abc')) // => ParseSuccess<symbol>
ts
parseSymbol('abc') // => ParseFailure
parseUndefined()
ts
function parseUndefined(data): ParseFailure | ParseSuccess<undefined>
Parse undefined
Example
ts
parseUndefined(undefined) // => ParseSuccess<undefined>
parseUndefined(null) // => ParseFailure
Parameters
Parameter | Type | Description |
---|---|---|
data | unknown | data to be validated |
Returns
ParseFailure
| ParseSuccess
<undefined
>