pacc 4.41.3 → 4.41.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pacc",
3
- "version": "4.41.3",
3
+ "version": "4.41.4",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "ava": "^6.4.1",
42
- "browser-ava": "^2.3.44",
42
+ "browser-ava": "^2.3.45",
43
43
  "c8": "^10.1.3",
44
44
  "documentation": "^14.0.3",
45
45
  "semantic-release": "^25.0.2",
@@ -23,15 +23,15 @@ export function definePropertiesFromAttributes(
23
23
  const name = path.join(".");
24
24
  const externalName = attribute.externalName ?? name;
25
25
 
26
- let value =
26
+ const value = prepareValue(
27
27
  getAttribute(initialValues, externalName, attribute) ??
28
- initialValues?.[externalName] ??
29
- attribute.default;
28
+ initialValues?.[externalName] ??
29
+ attribute.default,
30
+ attribute
31
+ );
30
32
 
31
33
  if (value !== undefined) {
32
34
  if (path.length === 1) {
33
- value = prepareValue(value, attribute);
34
-
35
35
  const property = properties[name];
36
36
 
37
37
  if (property?.set) {
package/src/types.mjs CHANGED
@@ -1,5 +1,8 @@
1
1
  import { attributeIterator } from "./attributes.mjs";
2
2
 
3
+ const emptyStringIsUndefined = value =>
4
+ typeof value === "string" && value.length === 0 ? undefined : value;
5
+
3
6
  export const types = {
4
7
  string: { name: "string", primitive: true },
5
8
  number: {
@@ -32,7 +35,11 @@ export const types = {
32
35
  prepareValue: value =>
33
36
  typeof value === "string" ? parseFloat(value) : value
34
37
  },
35
- url: { name: "url", primitive: true },
38
+ url: {
39
+ name: "url",
40
+ prepareValue: emptyStringIsUndefined,
41
+ primitive: true
42
+ },
36
43
  object: { name: "object" }
37
44
  };
38
45
 
package/types/types.d.mts CHANGED
@@ -34,6 +34,7 @@ export const types: {
34
34
  };
35
35
  url: {
36
36
  name: string;
37
+ prepareValue: (value: any) => any;
37
38
  primitive: boolean;
38
39
  };
39
40
  object: {