pacc 7.0.0 → 7.0.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 +10 -4
- package/package.json +1 -1
- package/src/multiple.mjs +4 -3
- package/src/types.mjs +1 -1
package/README.md
CHANGED
|
@@ -51,12 +51,13 @@ const result = getAttribute({ a: [0,{ b: 4 }]}, "a[1].b");
|
|
|
51
51
|
* [version\_attribute\_writable](#version_attribute_writable)
|
|
52
52
|
* [description\_attribute](#description_attribute)
|
|
53
53
|
* [boolean\_attribute](#boolean_attribute)
|
|
54
|
+
* [boolean\_attribute](#boolean_attribute-1)
|
|
54
55
|
* [boolean\_attribute\_writable](#boolean_attribute_writable)
|
|
55
56
|
* [boolean\_attribute\_writable\_true](#boolean_attribute_writable_true)
|
|
56
57
|
* [boolean\_attribute\_writable\_true](#boolean_attribute_writable_true-1)
|
|
57
58
|
* [boolean\_attribute\_writable\_false](#boolean_attribute_writable_false)
|
|
58
59
|
* [boolean\_attribute\_false](#boolean_attribute_false)
|
|
59
|
-
* [
|
|
60
|
+
* [yesno\_attribute](#yesno_attribute)
|
|
60
61
|
* [uuid\_attribute](#uuid_attribute)
|
|
61
62
|
* [secret\_attribute](#secret_attribute)
|
|
62
63
|
* [secret\_attribute](#secret_attribute-1)
|
|
@@ -218,7 +219,8 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
|
|
|
218
219
|
* `default` **any?** the default value
|
|
219
220
|
* `set` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** set the value
|
|
220
221
|
* `get` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** get the value can be used to calculate default values
|
|
221
|
-
* `
|
|
222
|
+
* `toInternal` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** 
|
|
223
|
+
* `toExternal` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** 
|
|
222
224
|
* `values` **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)\<any>?** allowed values
|
|
223
225
|
* `externalName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** attribute name used by external system
|
|
224
226
|
* `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
|
|
@@ -290,6 +292,10 @@ Type: [AttributeDefinition](#attributedefinition)
|
|
|
290
292
|
|
|
291
293
|
Type: [AttributeDefinition](#attributedefinition)
|
|
292
294
|
|
|
295
|
+
## boolean\_attribute
|
|
296
|
+
|
|
297
|
+
Type: [AttributeDefinition](#attributedefinition)
|
|
298
|
+
|
|
293
299
|
## boolean\_attribute\_writable
|
|
294
300
|
|
|
295
301
|
Type: [AttributeDefinition](#attributedefinition)
|
|
@@ -310,7 +316,7 @@ Type: [AttributeDefinition](#attributedefinition)
|
|
|
310
316
|
|
|
311
317
|
Type: [AttributeDefinition](#attributedefinition)
|
|
312
318
|
|
|
313
|
-
##
|
|
319
|
+
## yesno\_attribute
|
|
314
320
|
|
|
315
321
|
Type: [AttributeDefinition](#attributedefinition)
|
|
316
322
|
|
|
@@ -738,7 +744,7 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
|
|
|
738
744
|
|
|
739
745
|
* `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
740
746
|
* `primitive` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** 
|
|
741
|
-
* `
|
|
747
|
+
* `toInternal` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** 
|
|
742
748
|
|
|
743
749
|
## raiseOnUnknownType
|
|
744
750
|
|
package/package.json
CHANGED
package/src/multiple.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { setAttribute, getAttribute } from "./settergetter.mjs";
|
|
2
|
-
import { attributeIterator } from "./attributes.mjs";
|
|
3
|
-
|
|
2
|
+
import { attributeIterator, toExternal } from "./attributes.mjs";
|
|
3
|
+
import { default_attribute } from "./common-attributes.mjs";
|
|
4
4
|
/**
|
|
5
5
|
* Copies attribute values from a source object into a destination object.
|
|
6
6
|
* @param {Object} object target object to be modified
|
|
@@ -71,10 +71,11 @@ export function getAttributesJSON(object, definitions, filter) {
|
|
|
71
71
|
|
|
72
72
|
let value = getAttribute(object, name, def);
|
|
73
73
|
if (value !== undefined) {
|
|
74
|
+
value = toExternal(value);
|
|
74
75
|
if (value instanceof Set) {
|
|
75
76
|
value = [...value];
|
|
76
77
|
}
|
|
77
|
-
setAttribute(result, def.externalName ?? name, value,
|
|
78
|
+
setAttribute(result, def.externalName ?? name, value, default_attribute);
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
return result;
|
package/src/types.mjs
CHANGED
|
@@ -35,7 +35,7 @@ export const types = {
|
|
|
35
35
|
!value || value === "0" || value === "false" || value === "no"
|
|
36
36
|
? false
|
|
37
37
|
: true,
|
|
38
|
-
toExternal: value => value ? "yes" : "no"
|
|
38
|
+
toExternal: value => value === undefined ? undefined : value ? "yes" : "no"
|
|
39
39
|
},
|
|
40
40
|
integer: {
|
|
41
41
|
name: "integer",
|