Socket
Socket
Sign inDemoInstall

io-ts

Package Overview
Dependencies
1
Maintainers
1
Versions
120
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.9.0-dev.20171117 to 0.9.0-dev.20171122

8

lib/index.js

@@ -36,3 +36,5 @@ "use strict";

var _this = this;
return new Type(name || "pipe(" + this.name + ", " + ab.name + ")", function (v) { return _this.is(v) && ab.is(v); }, function (s, c) { return _this.validate(s, c).chain(function (a) { return ab.validate(a, c); }); }, this.serialize === exports.identity && ab.serialize === exports.identity ? exports.identity : function (b) { return _this.serialize(ab.serialize(b)); });
return new Type(name || "pipe(" + this.name + ", " + ab.name + ")", function (v) { return _this.is(v) && ab.is(v); }, function (s, c) { return _this.validate(s, c).chain(function (a) { return ab.validate(a, c); }); }, this.serialize === exports.identity && ab.serialize === exports.identity
? exports.identity
: function (b) { return _this.serialize(ab.serialize(b)); });
};

@@ -310,3 +312,5 @@ return Type;

var getNameFromProps = function (props) {
return "{ " + Object.keys(props).map(function (k) { return k + ": " + props[k].name; }).join(', ') + " }";
return "{ " + Object.keys(props)
.map(function (k) { return k + ": " + props[k].name; })
.join(', ') + " }";
};

@@ -313,0 +317,0 @@ var useIdentity = function (props) {

{
"name": "io-ts",
"version": "0.9.0-dev.20171117",
"version": "0.9.0-dev.20171122",
"description": "TypeScript compatible runtime type system for IO validation",

@@ -13,4 +13,6 @@ "files": ["lib"],

"prettier": "prettier --no-semi --single-quote --print-width 120 --parser typescript --list-different \"{src,test}/**/*.ts\"",
"fix-prettier": "prettier --no-semi --single-quote --print-width 120 --parser typescript --write \"{src,test,examples,exercises}/**/*.ts\"",
"flow-copy-definition-files": "cp src/*.js.flow lib",
"flow-test": "flow status",
"flow-fix-prettier": "prettier --no-semi --single-quote --print-width 120 --parser flow --write \"{src,test,examples,exercises}/**/*.js.flow\"",
"test": "npm run prettier && npm run lint && npm run typings-checker && npm run mocha",

@@ -31,3 +33,3 @@ "clean": "rm -rf lib/*",

"dependencies": {
"fp-ts": "^0.6.0"
"fp-ts": "0.6.4-dev.20171122"
},

@@ -38,3 +40,3 @@ "devDependencies": {

"mocha": "3.2.0",
"prettier": "1.5.2",
"prettier": "1.8.2",
"ts-node": "3.2.0",

@@ -41,0 +43,0 @@ "tslint": "4.4.2",

@@ -157,31 +157,31 @@ # The idea

| Type | TypeScript annotation syntax | Runtime type / combinator |
|------|-------|-------------|
| null | `null` | `t.null` or `t.nullType` |
| undefined | `undefined` | `t.undefined` |
| string | `string` | `t.string` |
| number | `number` | `t.number` |
| boolean | `boolean` | `t.boolean` |
| any | `any` | `t.any` |
| never | `never` | `t.never` |
| object | `object` | `t.object` |
| integer | ✘ | `t.Integer` |
| array of any | `Array<any>` | `t.Array` |
| array of type | `Array<A>` | `t.array(A)` |
| dictionary of any | `{ [key: string]: any }` | `t.Dictionary` |
| dictionary of type | `{ [K in A]: B }` | `t.dictionary(A, B)` |
| function | `Function` | `t.Function` |
| literal | `'s'` | `t.literal('s')` |
| partial | `Partial<{ name: string }>` | `t.partial({ name: t.string })` |
| readonly | `Readonly<T>` | `t.readonly(T)` |
| readonly array | `ReadonlyArray<number>` | `t.readonlyArray(t.number)` |
| interface | `interface A { name: string }` | `t.interface({ name: t.string })` or `t.type({ name: t.string })` |
| interface inheritance | `interface B extends A {}` | `t.intersection([ A, t.interface({}) ])` |
| tuple | `[ A, B ]` | `t.tuple([ A, B ])` |
| union | `A \| B` | `t.union([ A, B ])` |
| intersection | `A & B` | `t.intersection([ A, B ])` |
| keyof | `keyof M` | `t.keyof(M)` |
| recursive types | see [Recursive types](#recursive-types) | `t.recursion(name, definition)` |
| refinement | ✘ | `t.refinement(A, predicate)` |
| strict | ✘ | `t.strict({ name: t.string })` |
| Type | TypeScript | Flow | Runtime type / combinator |
|------|------------|------|---------------------------|
| null | `null` | `null` | `t.null` or `t.nullType` |
| undefined | `undefined` | `void` | `t.undefined` |
| string | `string` | `string` | `t.string` |
| number | `number` | `number` | `t.number` |
| boolean | `boolean` | `boolean` | `t.boolean` |
| any | `any` | `any` | `t.any` |
| never | `never` | `empty` | `t.never` |
| object | `object` | ✘ | `t.object` |
| integer | ✘ | ✘ | `t.Integer` |
| array of any | `Array<any>` | `Array<any>` | `t.Array` |
| array of type | `Array<A>` | `Array<A>` | `t.array(A)` |
| dictionary of any | `{ [key: string]: any }` | `{ [key: string]: any }` | `t.Dictionary` |
| dictionary of type | `{ [K in A]: B }` | `{ [key: A]: B }` | `t.dictionary(A, B)` |
| function | `Function` | `Function` | `t.Function` |
| literal | `'s'` | `'s'` | `t.literal('s')` |
| partial | `Partial<{ name: string }>` | `$Shape<{ name: string }>` | `t.partial({ name: t.string })` |
| readonly | `Readonly<T>` | `ReadOnly<T>` | `t.readonly(T)` |
| readonly array | `ReadonlyArray<number>` | `ReadOnlyArray<number>` | `t.readonlyArray(t.number)` |
| interface | `interface A { name: string }` | `interface A { name: string }` | `t.interface({ name: t.string })` or `t.type({ name: t.string })` |
| interface inheritance | `interface B extends A {}` | `interface B extends A {}` | `t.intersection([ A, t.interface({}) ])` |
| tuple | `[ A, B ]` | `[ A, B ]` | `t.tuple([ A, B ])` |
| union | `A \| B` | `A \| B` | `t.union([ A, B ])` |
| intersection | `A & B` | `A & B` | `t.intersection([ A, B ])` |
| keyof | `keyof M` | `$Keys<M>` | `t.keyof(M)` |
| recursive types | see [Recursive types](#recursive-types) | see [Recursive types](#recursive-types) | `t.recursion(name, definition)` |
| refinement | ✘ | ✘ | `t.refinement(A, predicate)` |
| strict/exact types | ✘ | `$Exact<{{ name: t.string }}>` | `t.strict({ name: t.string })` |

@@ -198,3 +198,3 @@ # Refinements

# Strict interfaces
# Strict/Exact interfaces

@@ -201,0 +201,0 @@ You can make an interface strict (which means that only the given properties are allowed) using the `strict` combinator

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc