Socket
Socket
Sign inDemoInstall

serializer.ts

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serializer.ts - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

2

package.json
{
"name": "serializer.ts",
"version": "0.0.7",
"version": "0.0.8",
"description": "Proper serialization and deserialization raw json objects to classes in Typescript",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",

@@ -40,14 +40,36 @@ "use strict";

return "break";
if (object[key] instanceof Function)
return "break";
if (options && options.skipStartedWith &&
key.substr(0, options.skipStartedWith.length) === options.skipStartedWith)
return "break";
var type = this_1.getType(cls, key);
if (object[key] instanceof Array) {
// if (object[key].length > 0 && !type && operationType === "deserialization")
// throw new TypeMissingError(cls, key);
if (object[key].length > 0 && type) {
newObject[key] = object[key].map(function (arrayItem) { return _this.convert(type, arrayItem, operationType); });
if (typeof object[key] !== "function") {
if (options && options.skipStartedWith &&
key.substr(0, options.skipStartedWith.length) === options.skipStartedWith)
return "break";
var type_1 = this_1.getType(cls, key);
if (object[key] instanceof Array) {
// if (object[key].length > 0 && !type && operationType === "deserialization")
// throw new TypeMissingError(cls, key);
if (object[key].length > 0 && type_1) {
newObject[key] = object[key].map(function (arrayItem) { return _this.convert(type_1, arrayItem, operationType); });
}
else {
newObject[key] = object[key];
}
}
else if (object[key] instanceof Object || type_1) {
if (!type_1 && operationType === "deserialization")
throw new TypeMissingError_1.TypeMissingError(cls, key);
if (type_1 === Date) {
newObject[key] = new Date(object[key]);
}
else if (type_1 === String) {
newObject[key] = String(object[key]);
}
else if (type_1 === Number) {
newObject[key] = Number(object[key]);
}
else if (type_1 === Boolean) {
newObject[key] = Boolean(object[key]);
}
else {
newObject[key] = this_1.convert(type_1, object[key], operationType);
}
}
else {

@@ -57,24 +79,2 @@ newObject[key] = object[key];

}
else if (object[key] instanceof Object || type) {
if (!type && operationType === "deserialization")
throw new TypeMissingError_1.TypeMissingError(cls, key);
if (type === Date) {
newObject[key] = new Date(object[key]);
}
else if (type === String) {
newObject[key] = String(object[key]);
}
else if (type === Number) {
newObject[key] = Number(object[key]);
}
else if (type === Boolean) {
newObject[key] = Boolean(object[key]);
}
else {
newObject[key] = this_1.convert(type, object[key], operationType);
}
}
else {
newObject[key] = object[key];
}
};

@@ -81,0 +81,0 @@ var this_1 = this;

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