@airpower/transformer 0.2.0 → 0.2.2

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.
Files changed (2) hide show
  1. package/dist/main.js +8 -6
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -133,26 +133,28 @@ class Transformer {
133
133
  * @param fields 属性列表
134
134
  */
135
135
  expose(...fields) {
136
- const fieldList = Object.keys(this);
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
- this[field] = void 0;
140
+ copy[field] = void 0;
140
141
  }
141
142
  }
142
- return this;
143
+ return copy;
143
144
  }
144
145
  /**
145
146
  * ### 排除部分类的属性
146
147
  * @param fields 属性列表
147
148
  */
148
149
  exclude(...fields) {
149
- const fieldList = Object.keys(this);
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
- this[field] = void 0;
154
+ copy[field] = void 0;
153
155
  }
154
156
  }
155
- return this;
157
+ return copy;
156
158
  }
157
159
  /**
158
160
  * ### 用指定的数据对当前实例进行覆盖
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@airpower/transformer",
3
3
  "type": "module",
4
- "version": "0.2.0",
4
+ "version": "0.2.2",
5
5
  "description": "AirPower-Transformer 是一个基于 TypeScript 的数据转换器,提供了从 JSON 对象到 类实例 对象之间互相转换的系列装饰器和方法。",
6
6
  "author": {
7
7
  "name": "Hamm",