pacc 4.12.0 → 4.12.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 CHANGED
@@ -424,6 +424,7 @@ The name may be a property path like 'a.b.c' or a\[2]
424
424
 
425
425
  * `object` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
426
426
  * `expression` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
427
+ * `definition`  
427
428
 
428
429
  Returns **any** value associated with the given property name
429
430
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pacc",
3
- "version": "4.12.0",
3
+ "version": "4.12.1",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -2,8 +2,11 @@ const types = {
2
2
  base: { name: "base" },
3
3
  string: { name: "string" },
4
4
  number: { name: "number" },
5
- integer: { name: "integer" },
6
- "unsigned-integer": { name: "unsigned-integer" },
5
+ integer: {
6
+ name: "integer",
7
+ convertValue: value => (typeof value === "string" ? parseInt(value) : value)
8
+ },
9
+ "unsigned-integer": { name: "unsigned-integer", extends: "integer" },
7
10
  boolean: {
8
11
  name: "boolean",
9
12
  convertValue: value => (!value || value === "0" ? false : true)
@@ -15,7 +18,7 @@ const types = {
15
18
  /**
16
19
  * Create attributes from its definition.
17
20
  * @param {Object} newDefinitions
18
- * @param {Object|undefined} presentDefinitions optional merg in attributes
21
+ * @param {Object} [presentDefinitions] optional merg in attributes
19
22
  * @return {Object} attributes
20
23
  */
21
24
  export function prepareAttributesDefinitions(
package/src/module.mjs CHANGED
@@ -3,6 +3,7 @@ export * from "./filter.mjs";
3
3
  export * from "./multiple.mjs";
4
4
  export * from "./attributes.mjs";
5
5
  export * from "./common-attributes.mjs";
6
+ export * from "./properties.mjs";
6
7
  export {
7
8
  setAttribute,
8
9
  getAttribute,
@@ -6,7 +6,7 @@ export function definePropertiesFromAttributes(
6
6
  object,
7
7
  attributes,
8
8
  values,
9
- properties
9
+ properties={}
10
10
  ) {
11
11
  const applyLater = {};
12
12
 
@@ -24,7 +24,6 @@ export function definePropertiesFromAttributes(
24
24
  value = convertValue(value, attribute);
25
25
  const property = properties[name];
26
26
 
27
- console.log(name, value);
28
27
  if (op?.set || property?.set) {
29
28
  applyLater[name] = value;
30
29
  } else {
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Create attributes from its definition.
3
3
  * @param {Object} newDefinitions
4
- * @param {Object|undefined} presentDefinitions optional merg in attributes
4
+ * @param {Object} [presentDefinitions] optional merg in attributes
5
5
  * @return {Object} attributes
6
6
  */
7
- export function prepareAttributesDefinitions(newDefinitions: any, presentDefinitions: any | undefined): any;
7
+ export function prepareAttributesDefinitions(newDefinitions: any, presentDefinitions?: any): any;
8
8
  /**
9
9
  * iterate over all attributes.
10
10
  * @param {Object} definition
@@ -3,4 +3,5 @@ export * from "./filter.mjs";
3
3
  export * from "./multiple.mjs";
4
4
  export * from "./attributes.mjs";
5
5
  export * from "./common-attributes.mjs";
6
+ export * from "./properties.mjs";
6
7
  export { setAttribute, getAttribute, getAttributeAndOperator } from "./settergetter.mjs";
@@ -1 +1 @@
1
- export function definePropertiesFromAttributes(object: any, attributes: any, values: any, properties: any): void;
1
+ export function definePropertiesFromAttributes(object: any, attributes: any, values: any, properties?: {}): void;