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

typit

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

typit - npm Package Compare versions

Comparing version 0.6.3 to 0.6.4

2

.d.ts/special-type.d.ts

@@ -8,3 +8,3 @@ import { Type } from "./type";

static readonly NULL: SpecialType<null>;
static readonly NON_PRESENT: SpecialType<null>;
static readonly NOT_PRESENT: SpecialType<null>;
protected typeName: string;

@@ -11,0 +11,0 @@ protected validator: Validator;

@@ -28,15 +28,2 @@ "use strict";

exports.OrType = union_type_1.UnionType;
const main_1 = require("./main");
let typeDef = {
name: main_1.StandardType.STRING,
age: main_1.StandardType.NUMBER,
alive: new main_1.OrType(main_1.StandardType.BOOLEAN, main_1.SpecialType.UNDEFINED)
};
let obj = {
name: 12,
age: "Yes",
alive: true
};
let type = new main_1.ObjectType(typeDef);
console.log("Conforms: " + type.checkConformity(obj));
//# sourceMappingURL=main.js.map

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

else if (!type.isOptional()) {
nonConformities.push(new malformed_object_error_1.MalformedObjectError([typePropertyName], type, input[typePropertyName], special_type_1.SpecialType.NON_PRESENT));
nonConformities.push(new malformed_object_error_1.MalformedObjectError([typePropertyName], type, input[typePropertyName], special_type_1.SpecialType.NOT_PRESENT));
}

@@ -84,0 +84,0 @@ }

@@ -24,4 +24,4 @@ "use strict";

SpecialType.NULL = new SpecialType("null", (input) => input === null);
SpecialType.NON_PRESENT = new SpecialType("non-present", (input) => false);
SpecialType.NOT_PRESENT = new SpecialType("not-present", (input) => false);
exports.SpecialType = SpecialType;
//# sourceMappingURL=special-type.js.map
{
"name": "typit",
"version": "0.6.3",
"version": "0.6.4",
"description": "Fully recursive runtime typechecking.",

@@ -5,0 +5,0 @@ "main": "js/main",

@@ -35,33 +35,2 @@ /*

UnionType as OrType
} from "./union-type";
import {
ObjectType,
ObjectTypeDefinition,
// MalformedObjectError,
OrType,
SpecialType,
StandardType
} from "./main";
let typeDef: ObjectTypeDefinition = {
name: StandardType.STRING,
age: StandardType.NUMBER,
alive: new OrType(StandardType.BOOLEAN, SpecialType.UNDEFINED)
};
let obj: any = {
name: 12,
age: "Yes",
alive: true
};
let type: ObjectType = new ObjectType(typeDef);
console.log("Conforms: " + type.checkConformity(obj));
// let nonConformities: any[] = type.listNonConformities(obj).map((error: MalformedObjectError): any => error.toJSON());
// console.log(nonConformities);
} from "./union-type";

@@ -210,3 +210,3 @@ /*

nonConformities.push(new MalformedObjectError([typePropertyName], type, input[typePropertyName], SpecialType.NON_PRESENT));
nonConformities.push(new MalformedObjectError([typePropertyName], type, input[typePropertyName], SpecialType.NOT_PRESENT));

@@ -213,0 +213,0 @@ }

@@ -55,4 +55,4 @@ /*

*/
public static readonly NON_PRESENT: SpecialType<null> = new SpecialType(
"non-present",
public static readonly NOT_PRESENT: SpecialType<null> = new SpecialType(
"not-present",
(input: any): boolean => false

@@ -59,0 +59,0 @@ );

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