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

runtypes

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

runtypes - npm Package Compare versions

Comparing version 0.9.2 to 0.10.0

lib/types/partial.d.ts

2

lib/index.d.ts

@@ -15,3 +15,3 @@ export { Runtype, Static } from './runtype';

export * from './types/record';
export * from './types/optional';
export * from './types/partial';
export * from './types/dictionary';

@@ -18,0 +18,0 @@ export * from './types/union';

@@ -20,3 +20,3 @@ "use strict";

__export(require("./types/record"));
__export(require("./types/optional"));
__export(require("./types/partial"));
__export(require("./types/dictionary"));

@@ -23,0 +23,0 @@ __export(require("./types/union"));

@@ -30,3 +30,3 @@ import { Runtype } from './runtype';

}> | {
tag: 'optional';
tag: 'partial';
fields: {

@@ -33,0 +33,0 @@ [_: string]: Reflect;

@@ -32,3 +32,3 @@ "use strict";

}
case 'optional': {
case 'partial': {
var keys = Object.keys(refl.fields);

@@ -35,0 +35,0 @@ return keys.length ? "{ " + keys

{
"name": "runtypes",
"version": "0.9.2",
"version": "0.10.0",
"description": "Runtime validation for static types",

@@ -9,5 +9,7 @@ "main": "./lib/index.js",

"build": "tsc --pretty",
"build:watch": "tsc --noEmit --pretty --watch",
"test": "npm run build && jest --verbose --coverage",
"test:watch": "jest --watchAll",
"coveralls": "cat ./coverage/remapped/lcov.info | ./node_modules/.bin/coveralls",
"develop": "jest --watchAll",
"upgrade": "updtr && npm shrinkwrap --dev",
"release": "npm run release:patch",

@@ -21,7 +23,8 @@ "release:patch": "xyz --increment patch",

"devDependencies": {
"@types/jest": "^18.1.1",
"coveralls": "^2.12.0",
"@types/jest": "^19.2.2",
"coveralls": "^2.13.0",
"jest": "^19.0.2",
"ts-jest": "^19.0.0",
"typescript": "2.2.1",
"ts-jest": "^19.0.6",
"typescript": "2.2.2",
"updtr": "^1.0.0",
"xyz": "^2.1.0"

@@ -28,0 +31,0 @@ },

@@ -16,3 +16,3 @@ import {

Record,
Optional,
Partial,
Tuple, Tuple2,

@@ -54,3 +54,3 @@ Union, Union2,

union1,
Partial: Optional({ foo: String }).And(Record({ Boolean })),
Partial: Partial({ foo: String }).And(Record({ Boolean })),
Function,

@@ -218,5 +218,5 @@ Person,

it('optional', () => {
const Opt = Optional({ x: Number, y: Literal(3) })
expectLiteralField(Opt, 'tag', 'optional')
it('partial', () => {
const Opt = Partial({ x: Number, y: Literal(3) })
expectLiteralField(Opt, 'tag', 'partial')
expectLiteralField(Opt.fields.x, 'tag', 'number')

@@ -270,3 +270,3 @@ expectLiteralField(Opt.fields.y, 'tag', 'literal')

| Record<{ [_ in string]: Reflect }>
| Optional<{ [_ in string]: Reflect }>
| Partial<{ [_ in string]: Reflect }>
| Tuple2<Reflect, Reflect>

@@ -307,3 +307,3 @@ | Union2<Reflect, Reflect>

break
case 'optional':
case 'partial':
check<{ [K in keyof typeof X.fields]?: Static<typeof X.fields['K']> }>(X)

@@ -310,0 +310,0 @@ break

@@ -15,3 +15,3 @@ export { Runtype, Static } from './runtype'

export * from './types/record'
export * from './types/optional'
export * from './types/partial'
export * from './types/dictionary'

@@ -18,0 +18,0 @@ export * from './types/union'

@@ -15,3 +15,3 @@ import { Runtype } from './runtype'

| { tag: 'record'; fields: { [_: string]: Reflect } } & Runtype<{ [_ in string]: always }>
| { tag: 'optional'; fields: { [_: string]: Reflect } } & Runtype<{ [_ in string]?: always }>
| { tag: 'partial'; fields: { [_: string]: Reflect } } & Runtype<{ [_ in string]?: always }>
| { tag: 'dictionary'; key: 'string' | 'number'; value: Reflect } & Runtype<{ [_: string]: always }>

@@ -18,0 +18,0 @@ | { tag: 'tuple'; components: Reflect[] } & Runtype<[always]>

@@ -14,3 +14,3 @@ import {

Record,
Optional,
Partial,
Tuple,

@@ -42,3 +42,3 @@ Union,

[Record({}), '{}'],
[Optional({}), '{}'],
[Partial({}), '{}'],
[

@@ -49,3 +49,3 @@ Record({ x: String, y: Array(Boolean) }),

[
Optional({ x: String, y: Array(Boolean) }),
Partial({ x: String, y: Array(Boolean) }),
'{ x?: string; y?: boolean[]; }'

@@ -52,0 +52,0 @@ ],

@@ -36,3 +36,3 @@ import { Reflect } from './index'

}
case 'optional': {
case 'partial': {
const keys = Object.keys(refl.fields)

@@ -39,0 +39,0 @@ return keys.length ? `{ ${keys

Sorry, the diff of this file is not supported yet

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