pacc 4.22.0 → 4.23.0

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.22.0",
3
+ "version": "4.23.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -9,19 +9,19 @@ export const types = {
9
9
  number: {
10
10
  name: "number",
11
11
  extends: "base",
12
- convertValue: (value, attribute) =>
12
+ prepareValue: (value, attribute) =>
13
13
  typeof value === "string" ? parseFloat(value) : value
14
14
  },
15
15
  boolean: {
16
16
  name: "boolean",
17
17
  extends: "base",
18
- convertValue: (value, attribute) => (!value || value === "0" ? false : true)
18
+ prepareValue: (value, attribute) => (!value || value === "0" ? false : true)
19
19
  },
20
20
 
21
21
  integer: {
22
22
  name: "integer",
23
23
  extends: "base",
24
- convertValue: (value, attribute) =>
24
+ prepareValue: (value, attribute) =>
25
25
  typeof value === "string" ? parseInt(value) : value
26
26
  },
27
27
  "unsigned-integer": { name: "unsigned-integer", extends: "integer" },
@@ -91,9 +91,9 @@ export function* attributeIterator(definition, path = []) {
91
91
  }
92
92
  }
93
93
 
94
- export function convertValue(value, attribute) {
95
- if (attribute?.type?.convertValue) {
96
- return attribute.type.convertValue(value, attribute);
94
+ export function prepareValue(value, attribute) {
95
+ if (attribute?.type?.prepareValue) {
96
+ return attribute.type.prepareValue(value, attribute);
97
97
  }
98
98
  return value;
99
99
  }
@@ -1,6 +1,6 @@
1
1
  import { attributeIterator } from "./attributes.mjs";
2
2
  import { getAttribute, setAttribute } from "./settergetter.mjs";
3
- import { convertValue } from "./attributes.mjs";
3
+ import { prepareValue } from "./attributes.mjs";
4
4
 
5
5
  export function definePropertiesFromAttributes(
6
6
  object,
@@ -22,7 +22,7 @@ export function definePropertiesFromAttributes(
22
22
  name
23
23
  );
24
24
 
25
- value = convertValue(value, attribute);
25
+ value = prepareValue(value, attribute);
26
26
 
27
27
  const property = properties[name];
28
28
 
@@ -16,7 +16,7 @@ import {
16
16
  STAR
17
17
  } from "./tokens.mjs";
18
18
  import { parse } from "./expression.mjs";
19
- import { convertValue } from "./attributes.mjs";
19
+ import { prepareValue } from "./attributes.mjs";
20
20
 
21
21
  /**
22
22
  * Set object attribute.
@@ -48,7 +48,7 @@ export function setAttribute(object, expression, value, definition) {
48
48
  }
49
49
 
50
50
  if (anchor) {
51
- anchor[anchorKey] = convertValue(value, definition);
51
+ anchor[anchorKey] = prepareValue(value, definition);
52
52
  }
53
53
  }
54
54
 
@@ -11,7 +11,7 @@ export function prepareAttributesDefinitions(newDefinitions: any, presentDefinit
11
11
  * @param {string[]} path
12
12
  */
13
13
  export function attributeIterator(definition: any, path?: string[]): any;
14
- export function convertValue(value: any, attribute: any): any;
14
+ export function prepareValue(value: any, attribute: any): any;
15
15
  export const baseTypes: Set<string>;
16
16
  export const types: {
17
17
  base: {
@@ -24,17 +24,17 @@ export const types: {
24
24
  number: {
25
25
  name: string;
26
26
  extends: string;
27
- convertValue: (value: any, attribute: any) => any;
27
+ prepareValue: (value: any, attribute: any) => any;
28
28
  };
29
29
  boolean: {
30
30
  name: string;
31
31
  extends: string;
32
- convertValue: (value: any, attribute: any) => boolean;
32
+ prepareValue: (value: any, attribute: any) => boolean;
33
33
  };
34
34
  integer: {
35
35
  name: string;
36
36
  extends: string;
37
- convertValue: (value: any, attribute: any) => any;
37
+ prepareValue: (value: any, attribute: any) => any;
38
38
  };
39
39
  "unsigned-integer": {
40
40
  name: string;