pacc 3.13.1 → 3.13.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pacc",
3
- "version": "3.13.1",
3
+ "version": "3.13.2",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -0,0 +1,52 @@
1
+ const types = {
2
+ base: { name: "base" },
3
+ string: { name: "string" },
4
+ number: { name: "number" },
5
+ integer: { name: "integer" },
6
+ "unsigned-integer": { name: "unsigned-integer" },
7
+ boolean: { name: "boolean" },
8
+ object: { name: "object" }
9
+ };
10
+
11
+ /**
12
+ * Create attributes from its definition.
13
+ * @param {Object} newDefinitions
14
+ * @param {Object|undefined} presentDefinitions optional merg in attributes
15
+ * @return {Object} attributes
16
+ */
17
+ export function prepareAttributesDefinitions(newDefinitions, presentDefinitions) {
18
+ for (const [name, d] of Object.entries(newDefinitions)) {
19
+ if (d.attributes === undefined) {
20
+ d.type = types[d.type] || types.base;
21
+ }
22
+ else {
23
+ prepareAttributesDefinitions(d.attributes);
24
+ }
25
+ }
26
+
27
+ return mergeAttributeDefinitions(newDefinitions, presentDefinitions);
28
+ }
29
+
30
+ /**
31
+ * Merge attribute definitions.
32
+ * @param {Object} dest attribute definitions to be used also the merge target
33
+ * @param {Object?} atts attribute definitions to be used
34
+ * @return {Object} merged definitions (dest)
35
+ */
36
+ function mergeAttributeDefinitions(dest, atts) {
37
+ if (atts) {
38
+ for (const [name, ca] of Object.entries(atts)) {
39
+ if (ca.attributes !== undefined) {
40
+ const bn = dest[name];
41
+
42
+ if (bn !== undefined) {
43
+ Object.assign(ca.attributes, bn.attributes);
44
+ }
45
+ }
46
+ }
47
+
48
+ return Object.assign(dest, atts);
49
+ }
50
+
51
+ return dest;
52
+ }
package/src/module.mjs CHANGED
@@ -1,9 +1,10 @@
1
1
  export * from "./tokens.mjs";
2
2
  export * from "./filter.mjs";
3
3
  export * from "./multiple.mjs";
4
+ export * from "./attributes.mjs";
4
5
  export * from "./common-attributes.mjs";
5
6
  export {
6
7
  setAttribute,
7
8
  getAttribute,
8
9
  getAttributeAndOperator
9
- } from "./attribute.mjs";
10
+ } from "./settergetter.mjs";
package/src/multiple.mjs CHANGED
@@ -1,57 +1,4 @@
1
- import { setAttribute, getAttribute } from "./attribute.mjs";
2
-
3
- const types = {
4
- base: { name: "base" },
5
- string: { name: "string" },
6
- number: { name: "number" },
7
- integer: { name: "integer" },
8
- "unsigned-integer": { name: "unsigned-integer" },
9
- boolean: { name: "boolean" },
10
- object: { name: "object" }
11
- };
12
-
13
- /**
14
- * Create attributes from its definition.
15
- * @param {Object} newDefinitions
16
- * @param {Object|undefined} presentDefinitions optional merg in attributes
17
- * @return {Object} attributes
18
- */
19
- export function prepareAttributesDefinitions(newDefinitions, presentDefinitions) {
20
- for (const [name, d] of Object.entries(newDefinitions)) {
21
- if (d.attributes === undefined) {
22
- d.type = types[d.type] || types.base;
23
- }
24
- else {
25
- prepareAttributesDefinitions(d.attributes);
26
- }
27
- }
28
-
29
- return mergeAttributeDefinitions(newDefinitions, presentDefinitions);
30
- }
31
-
32
- /**
33
- * Merge attribute definitions.
34
- * @param {Object} dest attribute definitions to be used also the merge target
35
- * @param {Object?} atts attribute definitions to be used
36
- * @return {Object} merged definitions (dest)
37
- */
38
- function mergeAttributeDefinitions(dest, atts) {
39
- if (atts) {
40
- for (const [name, ca] of Object.entries(atts)) {
41
- if (ca.attributes !== undefined) {
42
- const bn = dest[name];
43
-
44
- if (bn !== undefined) {
45
- Object.assign(ca.attributes, bn.attributes);
46
- }
47
- }
48
- }
49
-
50
- return Object.assign(dest, atts);
51
- }
52
-
53
- return dest;
54
- }
1
+ import { setAttribute, getAttribute } from "./settergetter.mjs";
55
2
 
56
3
  /**
57
4
  * Copies attribute values from a source object into a destination object.
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Create attributes from its definition.
3
+ * @param {Object} newDefinitions
4
+ * @param {Object|undefined} presentDefinitions optional merg in attributes
5
+ * @return {Object} attributes
6
+ */
7
+ export function prepareAttributesDefinitions(newDefinitions: any, presentDefinitions: any | undefined): any;
@@ -1,5 +1,6 @@
1
1
  export * from "./tokens.mjs";
2
2
  export * from "./filter.mjs";
3
3
  export * from "./multiple.mjs";
4
+ export * from "./attributes.mjs";
4
5
  export * from "./common-attributes.mjs";
5
- export { setAttribute, getAttribute, getAttributeAndOperator } from "./attribute.mjs";
6
+ export { setAttribute, getAttribute, getAttributeAndOperator } from "./settergetter.mjs";
@@ -1,10 +1,3 @@
1
- /**
2
- * Create attributes from its definition.
3
- * @param {Object} newDefinitions
4
- * @param {Object|undefined} presentDefinitions optional merg in attributes
5
- * @return {Object} attributes
6
- */
7
- export function prepareAttributesDefinitions(newDefinitions: any, presentDefinitions: any | undefined): any;
8
1
  /**
9
2
  * Copies attribute values from a source object into a destination object.
10
3
  * @param {Object} object target object to be modified
File without changes
File without changes