pacc 3.6.0 → 3.6.1
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 +28 -3
- package/package.json +1 -1
- package/src/multiple.mjs +4 -2
- package/types/multiple.d.mts +2 -2
package/README.md
CHANGED
|
@@ -40,15 +40,19 @@ const result = getAttribute({ a: [0,{ b: 4 }]}, "a[1].b");
|
|
|
40
40
|
* [Parameters](#parameters-4)
|
|
41
41
|
* [AttributeDefinition](#attributedefinition)
|
|
42
42
|
* [Properties](#properties)
|
|
43
|
-
* [
|
|
43
|
+
* [prepareAttributesDefinitions](#prepareattributesdefinitions)
|
|
44
44
|
* [Parameters](#parameters-5)
|
|
45
|
-
* [
|
|
45
|
+
* [mergeAttributeDefinitions](#mergeattributedefinitions)
|
|
46
46
|
* [Parameters](#parameters-6)
|
|
47
|
+
* [setAttributes](#setattributes)
|
|
48
|
+
* [Parameters](#parameters-7)
|
|
49
|
+
* [getAttributes](#getattributes)
|
|
50
|
+
* [Parameters](#parameters-8)
|
|
47
51
|
* [lookup](#lookup)
|
|
48
52
|
* [Token](#token)
|
|
49
53
|
* [Properties](#properties-1)
|
|
50
54
|
* [createToken](#createtoken)
|
|
51
|
-
* [Parameters](#parameters-
|
|
55
|
+
* [Parameters](#parameters-9)
|
|
52
56
|
* [PLUS](#plus)
|
|
53
57
|
* [MINUS](#minus)
|
|
54
58
|
* [STAR](#star)
|
|
@@ -151,6 +155,27 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
|
|
|
151
155
|
* `get` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** get the value can be used to calculate default values
|
|
152
156
|
* `env` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)> | [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))?** environment variable(s) used to provide the value
|
|
153
157
|
|
|
158
|
+
## prepareAttributesDefinitions
|
|
159
|
+
|
|
160
|
+
Create attributes from its definition.
|
|
161
|
+
|
|
162
|
+
### Parameters
|
|
163
|
+
|
|
164
|
+
* `definitions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
|
|
165
|
+
|
|
166
|
+
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** attributes
|
|
167
|
+
|
|
168
|
+
## mergeAttributeDefinitions
|
|
169
|
+
|
|
170
|
+
Merge attribute definitions.
|
|
171
|
+
|
|
172
|
+
### Parameters
|
|
173
|
+
|
|
174
|
+
* `dest` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** attribute definitions to be used also the merge target
|
|
175
|
+
* `atts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** attribute definitions to be used
|
|
176
|
+
|
|
177
|
+
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** merged definitions (dest)
|
|
178
|
+
|
|
154
179
|
## setAttributes
|
|
155
180
|
|
|
156
181
|
Copies attribute values from a source object into a destination object.
|
package/package.json
CHANGED
package/src/multiple.mjs
CHANGED
|
@@ -22,7 +22,9 @@ const types = {
|
|
|
22
22
|
base: { name: "base" },
|
|
23
23
|
string: { name: "string" },
|
|
24
24
|
number: { name: "number" },
|
|
25
|
-
|
|
25
|
+
integer: { name: "integer" },
|
|
26
|
+
boolean: { name: "boolean" },
|
|
27
|
+
object: { name: "object" }
|
|
26
28
|
};
|
|
27
29
|
|
|
28
30
|
/**
|
|
@@ -65,7 +67,7 @@ export function mergeAttributeDefinitions(dest, atts) {
|
|
|
65
67
|
* @param {Object} object target object to be modified
|
|
66
68
|
* @param {Object} source origin of the data to be copied
|
|
67
69
|
* @param {Object} definitions attribute definitions to be used
|
|
68
|
-
* @param {function} cb callback to be executed for each copied value
|
|
70
|
+
* @param {function?} cb callback to be executed for each copied value
|
|
69
71
|
*/
|
|
70
72
|
export function setAttributes(object, source, definitions, cb) {
|
|
71
73
|
for (const [name, def] of Object.entries(definitions)) {
|
package/types/multiple.d.mts
CHANGED
|
@@ -16,9 +16,9 @@ export function mergeAttributeDefinitions(dest: any, atts: any): any;
|
|
|
16
16
|
* @param {Object} object target object to be modified
|
|
17
17
|
* @param {Object} source origin of the data to be copied
|
|
18
18
|
* @param {Object} definitions attribute definitions to be used
|
|
19
|
-
* @param {function} cb callback to be executed for each copied value
|
|
19
|
+
* @param {function?} cb callback to be executed for each copied value
|
|
20
20
|
*/
|
|
21
|
-
export function setAttributes(object: any, source: any, definitions: any, cb: Function): void;
|
|
21
|
+
export function setAttributes(object: any, source: any, definitions: any, cb: Function | null): void;
|
|
22
22
|
/**
|
|
23
23
|
* Retrive attribute values from an object.
|
|
24
24
|
* @param {Object} object attribute value source
|