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 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.2",
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.12.0"
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 (Array.isArray(value) ? value : [...value]).join(attribute.separator);
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
- ? false
49
- : true
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
- ? false
59
- : true,
59
+ ? false
60
+ : true,
60
61
  toExternal: value =>
61
62
  value === undefined ? undefined : value ? "yes" : "no"
62
63
  },
package/types/types.d.mts CHANGED
@@ -65,5 +65,6 @@ export type Type = {
65
65
  name: string;
66
66
  primitive?: boolean;
67
67
  toInternal?: Function;
68
+ toExternal?: Function;
68
69
  };
69
70
  import { parseBytes } from "./bytes.mjs";