Comparing version
@@ -27,3 +27,3 @@ export { AsyncContract } from './asynccontract'; | ||
export { Never } from './types/never'; | ||
export { Boolean, Function, Number, String, Symbol } from './types/primative'; | ||
export { Boolean, Function, Number, String, Symbol, BigInt } from './types/primative'; | ||
export { Sealed } from './types/Sealed'; | ||
@@ -30,0 +30,0 @@ export { Union } from './types/union'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: !0 }); | ||
var e = require("./chunk-25d2eebd.js"); | ||
var e = require("./chunk-5f39c998.js"); | ||
(exports.Array = e.Arr), | ||
(exports.AsyncContract = e.AsyncContract), | ||
(exports.BigInt = e.BigInt), | ||
(exports.Boolean = e.Boolean), | ||
@@ -7,0 +8,0 @@ (exports.Brand = e.Brand), |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: !0 }); | ||
var e = require("./chunk-25d2eebd.js"); | ||
var e = require("./chunk-5f39c998.js"); | ||
e.provideHelpers({ | ||
@@ -5,0 +5,0 @@ Union: e.Union, |
@@ -17,2 +17,5 @@ import { Codec } from '../runtype'; | ||
} | ||
export interface BigInt extends Codec<bigint> { | ||
readonly tag: 'bigint'; | ||
} | ||
/** | ||
@@ -39,1 +42,5 @@ * Validates that a value is a boolean. | ||
export { Sym as Symbol }; | ||
/** | ||
* Validates that a value is a BigInt. | ||
*/ | ||
export declare const BigInt: BigInt; |
{ | ||
"name": "funtypes", | ||
"version": "5.0.3", | ||
"version": "5.1.0", | ||
"description": "Runtime validation for static types", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -9,3 +9,3 @@ # Funtypes | ||
[](https://github.com/ForbesLindesay/funtypes/actions?query=workflow%3ATest+branch%3Amaster) | ||
[](https://github.com/ForbesLindesay/funtypes/actions?query=workflow%3ATest+branch%3Amaster) | ||
[](https://coveralls.io/github/ForbesLindesay/funtypes) | ||
@@ -12,0 +12,0 @@ [](https://rollingversions.com/ForbesLindesay/funtypes) |
@@ -45,3 +45,3 @@ import { provideHelpers } from './runtype'; | ||
export { Never } from './types/never'; | ||
export { Boolean, Function, Number, String, Symbol } from './types/primative'; | ||
export { Boolean, Function, Number, String, Symbol, BigInt } from './types/primative'; | ||
export { Sealed } from './types/Sealed'; | ||
@@ -48,0 +48,0 @@ export { Union } from './types/union'; |
@@ -38,3 +38,3 @@ import { failure, success, unableToAssign } from '../result'; | ||
{ | ||
p(value, innerValidate) { | ||
p(value, innerValidate, _, mode) { | ||
const name = options && options.name; | ||
@@ -47,3 +47,3 @@ const validated = innerValidate(underlying, value); | ||
const result = constraint(validated.value as any); | ||
const result = constraint(mode === 'p' ? (validated.value as any) : value); | ||
if (!result || typeof result === 'string') { | ||
@@ -50,0 +50,0 @@ const message = |
@@ -25,4 +25,8 @@ import { failure, success } from '../result'; | ||
export interface BigInt extends Codec<bigint> { | ||
readonly tag: 'bigint'; | ||
} | ||
function createPrimative< | ||
TType extends 'boolean' | 'function' | 'number' | 'string' | 'symbol', | ||
TType extends 'boolean' | 'function' | 'number' | 'string' | 'symbol' | 'bigint', | ||
TValue, | ||
@@ -65,1 +69,6 @@ >(type: TType): Codec<TValue> & { readonly tag: TType } { | ||
export { Sym as Symbol }; | ||
/** | ||
* Validates that a value is a BigInt. | ||
*/ | ||
export const BigInt: BigInt = createPrimative('bigint'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
339496
0.67%95
1.06%9663
0.79%