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

@appolo/utils

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@appolo/utils - npm Package Compare versions

Comparing version 8.0.12 to 8.0.13

19

lib/classes.js

@@ -32,13 +32,26 @@ "use strict";

}
static createClassFromObject(klass, obj) {
let instance = new klass();
static classToPlain(klass) {
let dto = typeof klass["toJSON"] == "function" ? klass["toJSON"]() : JSON.parse(JSON.stringify(klass));
return dto;
}
static plainToClassInstance(instance, obj) {
if (typeof instance["formJSON"] == "function") {
instance["formJSON"](obj);
return instance;
}
let keys = Object.keys(obj);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
instance[key] = obj[key];
if (typeof instance[key] != "function") {
instance[key] = obj[key];
}
}
return instance;
}
static plainToClass(klass, obj) {
let instance = new klass(obj);
return Classes.plainToClassInstance(instance, obj);
}
}
exports.Classes = Classes;
//# sourceMappingURL=classes.js.map
import {Arrays} from "./arrays";
import {Functions} from "../index";
import {Functions, Util} from "../index";

@@ -40,9 +40,24 @@ export class Classes {

public static createClassFromObject<T>(klass: { new(): T }, obj: { [P in keyof T]: T[P] }): T {
let instance = new klass();
public static classToPlain<T>(klass: T ): { [P in keyof T]: T[P] } {
let dto = typeof klass["toJSON"] == "function" ? klass["toJSON"]() : JSON.parse(JSON.stringify(klass))
return dto
}
public static plainToClassInstance<T>(instance: T, obj: { [P in keyof T]: T[P] }): T {
if (typeof instance["formJSON"] == "function") {
instance["formJSON"](obj);
return instance;
}
let keys = Object.keys(obj);
for (let i = 0; i < keys.length; i++) {
let key = keys[i]
instance[key] = obj[key];
let key = keys[i];
if (typeof instance[key] != "function") {
instance[key] = obj[key];
}
}

@@ -52,2 +67,9 @@

}
public static plainToClass<T>(klass: { new(...args: any[]): T }, obj: { [P in keyof T]: T[P] }): T {
let instance = new klass(obj);
return Classes.plainToClassInstance(instance, obj)
}
}

2

package.json

@@ -20,3 +20,3 @@ {

"main": "./index.js",
"version": "8.0.12",
"version": "8.0.13",
"license": "MIT",

@@ -23,0 +23,0 @@ "repository": {

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