@fluojs/serialization 1.0.0-beta.6 → 1.0.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/README.ko.md +2 -2
- package/README.md +2 -2
- package/dist/serialize.d.ts.map +1 -1
- package/dist/serialize.js +5 -2
- package/package.json +3 -3
package/README.ko.md
CHANGED
|
@@ -37,7 +37,7 @@ class UserEntity {
|
|
|
37
37
|
id = '';
|
|
38
38
|
|
|
39
39
|
@Expose()
|
|
40
|
-
@Transform((value) => value.toUpperCase())
|
|
40
|
+
@Transform((value) => String(value).toUpperCase())
|
|
41
41
|
username = '';
|
|
42
42
|
|
|
43
43
|
@Exclude()
|
|
@@ -76,7 +76,7 @@ class SecureDto {
|
|
|
76
76
|
import { Transform } from '@fluojs/serialization';
|
|
77
77
|
|
|
78
78
|
class ProductDto {
|
|
79
|
-
@Transform((price) => `$${price.toFixed(2)}`)
|
|
79
|
+
@Transform((price) => `$${Number(price).toFixed(2)}`)
|
|
80
80
|
price = 0;
|
|
81
81
|
}
|
|
82
82
|
```
|
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ class UserEntity {
|
|
|
37
37
|
id = '';
|
|
38
38
|
|
|
39
39
|
@Expose()
|
|
40
|
-
@Transform((value) => value.toUpperCase())
|
|
40
|
+
@Transform((value) => String(value).toUpperCase())
|
|
41
41
|
username = '';
|
|
42
42
|
|
|
43
43
|
@Exclude()
|
|
@@ -76,7 +76,7 @@ class SecureDto {
|
|
|
76
76
|
import { Transform } from '@fluojs/serialization';
|
|
77
77
|
|
|
78
78
|
class ProductDto {
|
|
79
|
-
@Transform((price) => `$${price.toFixed(2)}`)
|
|
79
|
+
@Transform((price) => `$${Number(price).toFixed(2)}`)
|
|
80
80
|
price = 0;
|
|
81
81
|
}
|
|
82
82
|
```
|
package/dist/serialize.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../src/serialize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../src/serialize.ts"],"names":[],"mappings":"AAwQA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAOxD"}
|
package/dist/serialize.js
CHANGED
|
@@ -39,11 +39,14 @@ function assignSerializedProperty(target, propertyKey, value) {
|
|
|
39
39
|
}
|
|
40
40
|
target[propertyKey] = value;
|
|
41
41
|
}
|
|
42
|
+
function getEnumerableOwnSymbolKeys(value) {
|
|
43
|
+
return Object.getOwnPropertySymbols(value).filter(key => Object.prototype.propertyIsEnumerable.call(value, key));
|
|
44
|
+
}
|
|
42
45
|
function resolveCandidateKeys(value, fieldMetadata, excludeExtraneous) {
|
|
43
46
|
if (excludeExtraneous) {
|
|
44
47
|
return [...fieldMetadata.entries()].filter(([, metadata]) => metadata.exposed === true).map(([propertyKey]) => propertyKey);
|
|
45
48
|
}
|
|
46
|
-
const keys = new Set([...Object.keys(value), ...
|
|
49
|
+
const keys = new Set([...Object.keys(value), ...getEnumerableOwnSymbolKeys(value)]);
|
|
47
50
|
for (const [propertyKey, metadata] of fieldMetadata) {
|
|
48
51
|
if (metadata.exposed === true) {
|
|
49
52
|
keys.add(propertyKey);
|
|
@@ -130,7 +133,7 @@ function serializeClassInstance(value, context) {
|
|
|
130
133
|
});
|
|
131
134
|
}
|
|
132
135
|
function serializeRecord(value, context) {
|
|
133
|
-
const symbolKeys =
|
|
136
|
+
const symbolKeys = getEnumerableOwnSymbolKeys(value);
|
|
134
137
|
const keys = [...Object.keys(value), ...symbolKeys];
|
|
135
138
|
return serializeWithTrackedReference(value, context, () => ({}), serialized => {
|
|
136
139
|
for (const propertyKey of keys) {
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"output",
|
|
10
10
|
"transform"
|
|
11
11
|
],
|
|
12
|
-
"version": "1.0.
|
|
12
|
+
"version": "1.0.1",
|
|
13
13
|
"private": false,
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"repository": {
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@fluojs/core": "^1.0.
|
|
40
|
-
"@fluojs/http": "^1.0.0
|
|
39
|
+
"@fluojs/core": "^1.0.1",
|
|
40
|
+
"@fluojs/http": "^1.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"vitest": "^3.2.4"
|