Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fast-check-io-ts

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-check-io-ts - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

2

lib/index.d.ts
import * as fc from 'fast-check';
import * as t from 'io-ts';
export declare type SupportedType = t.StringType | t.VoidType | t.ArrayType<any> | t.BooleanType | t.ExactType<any> | t.KeyofType<any> | t.NullType | t.TupleType<Array<t.Any>> | t.UnknownType | t.UndefinedType | t.LiteralType<string | number | boolean> | t.NumberType | t.InterfaceType<unknown> | t.PartialType<unknown> | t.UnionType<Array<any>> | t.RefinementType<t.Any>;
export declare type SupportedType = t.StringType | t.VoidType | t.ArrayType<any> | t.BooleanType | t.ExactType<any> | t.KeyofType<any> | t.NullType | t.TupleType<Array<t.Any>> | t.UnknownType | t.UndefinedType | t.LiteralType<string | number | boolean> | t.NumberType | t.InterfaceType<unknown> | t.PartialType<unknown> | t.UnionType<Array<any>> | t.RefinementType<t.Any> | t.IntersectionType<Array<t.Any>>;
export declare function getArbitrary<T extends t.Mixed>(codec: T): fc.Arbitrary<T['_A']>;

@@ -6,2 +6,3 @@ "use strict";

var t = require("io-ts");
var objectTypes = ['ExactType', 'InterfaceType', 'PartialType'];
function getArbitrary(codec) {

@@ -42,2 +43,8 @@ var type = codec;

return getArbitrary(type.type).filter(type.predicate);
case 'IntersectionType':
var isObjectIntersection = objectTypes.includes(type.types[0]._tag);
return isObjectIntersection
? fc.tuple.apply(fc, type.types.map(getArbitrary)).map(function (values) { return Object.assign.apply(Object, [{}].concat(values)); })
.filter(type.is)
: fc.oneof.apply(fc, type.types.map(getArbitrary)).filter(type.is);
}

@@ -44,0 +51,0 @@ throw new Error("Codec not supported: " + codec);

{
"name": "fast-check-io-ts",
"version": "0.1.1",
"version": "0.2.0",
"description": "io-ts codec to fast-check arbitrary mapping",

@@ -5,0 +5,0 @@ "files": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc