pacc 8.0.2 → 8.0.4
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 +1 -0
- package/package.json +2 -2
- package/src/types.mjs +7 -6
- package/types/types.d.mts +1 -0
package/README.md
CHANGED
|
@@ -751,6 +751,7 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
|
|
|
751
751
|
* `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
752
752
|
* `primitive` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** 
|
|
753
753
|
* `toInternal` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** 
|
|
754
|
+
* `toExternal` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** 
|
|
754
755
|
|
|
755
756
|
## raiseOnUnknownType
|
|
756
757
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pacc",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"typescript": "^5.9.3"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
|
49
|
-
"node": ">=24.
|
|
49
|
+
"node": ">=24.13.0"
|
|
50
50
|
},
|
|
51
51
|
"repository": {
|
|
52
52
|
"type": "git",
|
package/src/types.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { parseBytes } from "./bytes.mjs";
|
|
|
7
7
|
* @property {string} name
|
|
8
8
|
* @property {boolean} [primitive]
|
|
9
9
|
* @property {Function} [toInternal]
|
|
10
|
+
* @property {Function} [toExternal]
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
13
|
const emptyStringIsUndefined = value =>
|
|
@@ -26,8 +27,8 @@ export const types = {
|
|
|
26
27
|
},
|
|
27
28
|
toExternal: (value, attribute) => {
|
|
28
29
|
if (value !== undefined) {
|
|
29
|
-
if (attribute.collection) {
|
|
30
|
-
return
|
|
30
|
+
if (attribute.collection && typeof value !== "string") {
|
|
31
|
+
return [...value].join(attribute.separator);
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
return value;
|
|
@@ -45,8 +46,8 @@ export const types = {
|
|
|
45
46
|
value === undefined
|
|
46
47
|
? attribute.default
|
|
47
48
|
: !value || value === "0" || value === "false" || value === "no"
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
? false
|
|
50
|
+
: true
|
|
50
51
|
},
|
|
51
52
|
yesno: {
|
|
52
53
|
name: "yesno",
|
|
@@ -55,8 +56,8 @@ export const types = {
|
|
|
55
56
|
value === undefined
|
|
56
57
|
? attribute.default
|
|
57
58
|
: !value || value === "0" || value === "false" || value === "no"
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
? false
|
|
60
|
+
: true,
|
|
60
61
|
toExternal: value =>
|
|
61
62
|
value === undefined ? undefined : value ? "yes" : "no"
|
|
62
63
|
},
|