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

json2typescript

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json2typescript - npm Package Compare versions

Comparing version 1.5.0 to 1.5.1

10

lib/cjs/src/json2typescript/json-convert.js

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

// Check if objects match
if ((expectedType instanceof Object || typeof expectedType === "string") && value instanceof Object) {
if (((expectedType instanceof Object && [String, Number, Boolean].includes(expectedType) === false) || typeof expectedType === "string") && value instanceof Object) {
// If the expected type is a string (means: lazy-loading), get the real type from the registered classes

@@ -1124,4 +1124,5 @@ if (typeof expectedType === "string") {

else {
if (this.ignorePrimitiveChecks)
if (this.ignorePrimitiveChecks && ["string", "number", "boolean"].includes(typeof (value))) {
return value;
}
throw new Error("\tReason: Given value type does not match the expected primitive type.");

@@ -1131,7 +1132,2 @@ }

}
console.log("---------2");
console.log(expectedDimension);
console.log(expectedType);
console.log(valueDimension);
console.log(value);
// All other attempts are fatal

@@ -1138,0 +1134,0 @@ throw new Error("\tReason: Mapping failed because of an unknown error.");

@@ -1075,3 +1075,3 @@ import { Any } from "./any";

// Check if objects match
if ((expectedType instanceof Object || typeof expectedType === "string") && value instanceof Object) {
if (((expectedType instanceof Object && [String, Number, Boolean].includes(expectedType) === false) || typeof expectedType === "string") && value instanceof Object) {
// If the expected type is a string (means: lazy-loading), get the real type from the registered classes

@@ -1121,4 +1121,5 @@ if (typeof expectedType === "string") {

else {
if (this.ignorePrimitiveChecks)
if (this.ignorePrimitiveChecks && ["string", "number", "boolean"].includes(typeof (value))) {
return value;
}
throw new Error("\tReason: Given value type does not match the expected primitive type.");

@@ -1128,7 +1129,2 @@ }

}
console.log("---------2");
console.log(expectedDimension);
console.log(expectedType);
console.log(valueDimension);
console.log(value);
// All other attempts are fatal

@@ -1135,0 +1131,0 @@ throw new Error("\tReason: Mapping failed because of an unknown error.");

{
"name": "json2typescript",
"version": "1.5.0",
"version": "1.5.1",
"description": "Provides TypeScript methods to map a JSON object to a JavaScript object on runtime",

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

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc