@airpower/transformer 0.0.4 → 0.0.5
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/README.md +11 -12
- package/package.json +4 -4
- package/dist/vite.config.d.ts +0 -2
- /package/dist/{src/decorator → decorator}/Alias.d.ts +0 -0
- /package/dist/{src/decorator → decorator}/IgnorePrefix.d.ts +0 -0
- /package/dist/{src/decorator → decorator}/Prefix.d.ts +0 -0
- /package/dist/{src/decorator → decorator}/ToClass.d.ts +0 -0
- /package/dist/{src/decorator → decorator}/ToJson.d.ts +0 -0
- /package/dist/{src/decorator → decorator}/Type.d.ts +0 -0
- /package/dist/{src/decorator → decorator}/index.d.ts +0 -0
- /package/dist/{src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{src/transformer → transformer}/DecoratorUtil.d.ts +0 -0
- /package/dist/{src/transformer → transformer}/IJson.d.ts +0 -0
- /package/dist/{src/transformer → transformer}/ITransformerConstructor.d.ts +0 -0
- /package/dist/{src/transformer → transformer}/Transformer.d.ts +0 -0
- /package/dist/{src/transformer → transformer}/index.d.ts +0 -0
- /package/dist/{src/type → type}/type.d.ts +0 -0
package/README.md
CHANGED
|
@@ -26,27 +26,27 @@ cnpm install @airpower/transformer
|
|
|
26
26
|
# 📖 使用说明
|
|
27
27
|
|
|
28
28
|
```ts
|
|
29
|
-
import {IgnorePrefix, Prefix, Transformer, Type} from '@airpower/transformer'
|
|
29
|
+
import { IgnorePrefix, Prefix, Transformer, Type } from '@airpower/transformer'
|
|
30
30
|
|
|
31
31
|
@Prefix('role____')
|
|
32
32
|
class Role extends Transformer {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
id!: number
|
|
34
|
+
name!: string
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
@Prefix('user_')
|
|
38
38
|
class User extends Transformer {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
id!: number
|
|
40
|
+
name!: string
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
@IgnorePrefix()
|
|
43
|
+
age!: number
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
@Type(Role)
|
|
46
|
+
role!: Role
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
@Type(Role, true)
|
|
49
|
+
roleList: Role[] = []
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
const user = new User()
|
|
@@ -68,7 +68,6 @@ console.warn('json', JSON.stringify(json))
|
|
|
68
68
|
json.name = '???' // 无效
|
|
69
69
|
const user2 = User.fromJson(json)
|
|
70
70
|
console.warn('user2', user2)
|
|
71
|
-
|
|
72
71
|
```
|
|
73
72
|
|
|
74
73
|
# ⏰ 欢迎反馈
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airpower/transformer",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"description": "AirPower-Transformer 是一个基于 TypeScript 的数据转换器,提供了从 JSON 对象到 类实例 对象之间互相转换的系列装饰器和方法。",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Hamm",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"module": "dist/main.js",
|
|
32
32
|
"types": "dist/index.d.ts",
|
|
33
33
|
"files": [
|
|
34
|
-
"
|
|
35
|
-
"
|
|
34
|
+
"assets",
|
|
35
|
+
"dist"
|
|
36
36
|
],
|
|
37
37
|
"scripts": {
|
|
38
|
-
"build": "tsc && vite build",
|
|
38
|
+
"build": "eslint && tsc && vite build",
|
|
39
39
|
"lint": "eslint src --ext .ts",
|
|
40
40
|
"preview": "vite preview"
|
|
41
41
|
},
|
package/dist/vite.config.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|