pacc 3.13.0 → 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/README.md +5 -0
- package/package.json +1 -4
- package/src/attributes.mjs +52 -0
- package/src/module.mjs +2 -1
- package/src/multiple.mjs +1 -54
- package/types/attributes.d.mts +7 -0
- package/types/module.d.mts +2 -1
- package/types/multiple.d.mts +0 -7
- /package/src/{attribute.mjs → settergetter.mjs} +0 -0
- /package/types/{attribute.d.mts → settergetter.d.mts} +0 -0
package/README.md
CHANGED
|
@@ -40,6 +40,7 @@ const result = getAttribute({ a: [0,{ b: 4 }]}, "a[1].b");
|
|
|
40
40
|
* [Properties](#properties)
|
|
41
41
|
* [default\_attribute](#default_attribute)
|
|
42
42
|
* [name\_attribute](#name_attribute)
|
|
43
|
+
* [email\_attribute](#email_attribute)
|
|
43
44
|
* [description\_attribute](#description_attribute)
|
|
44
45
|
* [type\_attribute](#type_attribute)
|
|
45
46
|
* [state\_attribute](#state_attribute)
|
|
@@ -184,6 +185,10 @@ Type: [AttributeDefinition](#attributedefinition)
|
|
|
184
185
|
|
|
185
186
|
Type: [AttributeDefinition](#attributedefinition)
|
|
186
187
|
|
|
188
|
+
## email\_attribute
|
|
189
|
+
|
|
190
|
+
Type: [AttributeDefinition](#attributedefinition)
|
|
191
|
+
|
|
187
192
|
## description\_attribute
|
|
188
193
|
|
|
189
194
|
The description of the object content.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pacc",
|
|
3
|
-
"version": "3.13.
|
|
3
|
+
"version": "3.13.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -32,9 +32,6 @@
|
|
|
32
32
|
"lint:docs": "documentation lint ./src**/*.mjs",
|
|
33
33
|
"lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule --target esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
|
|
34
34
|
},
|
|
35
|
-
"dependencies": {
|
|
36
|
-
"npm-pkgbuild": "^18.1.1"
|
|
37
|
-
},
|
|
38
35
|
"devDependencies": {
|
|
39
36
|
"ava": "^6.4.1",
|
|
40
37
|
"browser-ava": "^2.3.31",
|
|
@@ -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 "./
|
|
10
|
+
} from "./settergetter.mjs";
|
package/src/multiple.mjs
CHANGED
|
@@ -1,57 +1,4 @@
|
|
|
1
|
-
import { setAttribute, getAttribute } from "./
|
|
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;
|
package/types/module.d.mts
CHANGED
|
@@ -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 "./
|
|
6
|
+
export { setAttribute, getAttribute, getAttributeAndOperator } from "./settergetter.mjs";
|
package/types/multiple.d.mts
CHANGED
|
@@ -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
|