@airpower/transformer 0.1.13 → 0.2.1
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
|
@@ -133,26 +133,28 @@ class Transformer {
|
|
|
133
133
|
* @param fields 属性列表
|
|
134
134
|
*/
|
|
135
135
|
expose(...fields) {
|
|
136
|
-
const
|
|
136
|
+
const copy = this.copy();
|
|
137
|
+
const fieldList = Object.keys(copy);
|
|
137
138
|
for (const field of fieldList) {
|
|
138
139
|
if (!fields.includes(field)) {
|
|
139
|
-
|
|
140
|
+
copy[field] = void 0;
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
|
-
return
|
|
143
|
+
return copy;
|
|
143
144
|
}
|
|
144
145
|
/**
|
|
145
146
|
* ### 排除部分类的属性
|
|
146
147
|
* @param fields 属性列表
|
|
147
148
|
*/
|
|
148
149
|
exclude(...fields) {
|
|
149
|
-
const
|
|
150
|
+
const copy = this.copy();
|
|
151
|
+
const fieldList = Object.keys(copy);
|
|
150
152
|
for (const field of fieldList) {
|
|
151
153
|
if (fields.includes(field)) {
|
|
152
|
-
|
|
154
|
+
copy[field] = void 0;
|
|
153
155
|
}
|
|
154
156
|
}
|
|
155
|
-
return
|
|
157
|
+
return copy;
|
|
156
158
|
}
|
|
157
159
|
/**
|
|
158
160
|
* ### 用指定的数据对当前实例进行覆盖
|