@airpower/transformer 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js
CHANGED
|
@@ -161,10 +161,11 @@ class Transformer {
|
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
163
|
* ### 创建一个当前类的实例
|
|
164
|
+
* @param Class 类
|
|
164
165
|
* @param recoverBy `可选` 初始化用于覆盖对象实例的 `JSON`
|
|
165
166
|
*/
|
|
166
|
-
static newInstance(recoverBy) {
|
|
167
|
-
const instance = new
|
|
167
|
+
static newInstance(Class, recoverBy) {
|
|
168
|
+
const instance = new Class();
|
|
168
169
|
if (recoverBy) {
|
|
169
170
|
return instance.recoverBy(recoverBy);
|
|
170
171
|
}
|
|
@@ -19,9 +19,10 @@ export declare class Transformer {
|
|
|
19
19
|
static fromJsonArray<T extends Transformer>(this: ITransformerConstructor<T>, jsonArray?: IJson | IJson[]): T[];
|
|
20
20
|
/**
|
|
21
21
|
* ### 创建一个当前类的实例
|
|
22
|
+
* @param Class 类
|
|
22
23
|
* @param recoverBy `可选` 初始化用于覆盖对象实例的 `JSON`
|
|
23
24
|
*/
|
|
24
|
-
static newInstance<T extends Transformer>(
|
|
25
|
+
static newInstance<T extends Transformer>(Class: ITransformerConstructor<T>, recoverBy?: IJson): T;
|
|
25
26
|
/**
|
|
26
27
|
* ### 转换 `JSON` 为实体
|
|
27
28
|
* 会自动进行数据别名转换
|