pacc 8.0.0 → 8.0.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.
- package/README.md +1 -0
- package/package.json +1 -1
- package/src/common-attributes.mjs +1 -0
- package/src/types.mjs +22 -2
- package/types/common-attributes.d.mts +1 -0
- package/types/types.d.mts +2 -0
package/README.md
CHANGED
package/package.json
CHANGED
package/src/types.mjs
CHANGED
|
@@ -13,7 +13,26 @@ const emptyStringIsUndefined = value =>
|
|
|
13
13
|
typeof value === "string" && value.length === 0 ? undefined : value;
|
|
14
14
|
|
|
15
15
|
export const types = {
|
|
16
|
-
string: {
|
|
16
|
+
string: {
|
|
17
|
+
name: "string",
|
|
18
|
+
primitive: true,
|
|
19
|
+
toInternal: (value, attribute) => {
|
|
20
|
+
if (typeof value === "string") {
|
|
21
|
+
if (attribute.collection) {
|
|
22
|
+
return value.split(attribute.separator);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return value;
|
|
26
|
+
},
|
|
27
|
+
toExternal: (value, attribute) => {
|
|
28
|
+
if (value !== undefined) {
|
|
29
|
+
if (attribute.collection) {
|
|
30
|
+
return (Array.isArray(value) ? value : [...value]).join(attribute.separator);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
35
|
+
},
|
|
17
36
|
number: {
|
|
18
37
|
name: "number",
|
|
19
38
|
primitive: true,
|
|
@@ -55,7 +74,8 @@ export const types = {
|
|
|
55
74
|
name: "duration",
|
|
56
75
|
primitive: true,
|
|
57
76
|
toInternal: value => parseDuration(value),
|
|
58
|
-
toExternal: value =>
|
|
77
|
+
toExternal: value =>
|
|
78
|
+
value === undefined ? undefined : formatDuration(value)
|
|
59
79
|
},
|
|
60
80
|
duration_ms: {
|
|
61
81
|
name: "duration_ms",
|
|
@@ -31,6 +31,7 @@ export const default_attribute: AttributeDefinition;
|
|
|
31
31
|
*/
|
|
32
32
|
export const default_attribute_writable: AttributeDefinition;
|
|
33
33
|
export namespace string_collection_attribute {
|
|
34
|
+
export let separator: string;
|
|
34
35
|
export let collection: boolean;
|
|
35
36
|
export let type: object;
|
|
36
37
|
export let isKey: boolean;
|