pacc 3.1.0 → 3.1.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 +32 -2
- package/package.json +4 -4
- package/src/attribute.mjs +8 -1
- package/src/tokens.mjs +1 -0
- package/types/attribute.d.mts +6 -1
package/README.md
CHANGED
|
@@ -29,14 +29,20 @@ const result = getAttribute({ a: [0,{ b: 4 }]}, "a[1].b");
|
|
|
29
29
|
|
|
30
30
|
* [AttributeDefinition](#attributedefinition)
|
|
31
31
|
* [Properties](#properties)
|
|
32
|
+
* [Token](#token)
|
|
33
|
+
* [Properties](#properties-1)
|
|
34
|
+
* [Token](#token-1)
|
|
35
|
+
* [Properties](#properties-2)
|
|
32
36
|
* [setAttribute](#setattribute)
|
|
33
37
|
* [Parameters](#parameters)
|
|
34
38
|
* [getAttribute](#getattribute)
|
|
35
39
|
* [Parameters](#parameters-1)
|
|
36
40
|
* [getAttributeAndOperator](#getattributeandoperator)
|
|
37
41
|
* [Parameters](#parameters-2)
|
|
38
|
-
* [
|
|
42
|
+
* [createToken](#createtoken)
|
|
39
43
|
* [Parameters](#parameters-3)
|
|
44
|
+
* [tokens](#tokens)
|
|
45
|
+
* [Parameters](#parameters-4)
|
|
40
46
|
|
|
41
47
|
## AttributeDefinition
|
|
42
48
|
|
|
@@ -55,6 +61,22 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
|
|
|
55
61
|
* `get` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** get the value can be used to calculate default values
|
|
56
62
|
* `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 use to provide the value
|
|
57
63
|
|
|
64
|
+
## Token
|
|
65
|
+
|
|
66
|
+
Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
67
|
+
|
|
68
|
+
### Properties
|
|
69
|
+
|
|
70
|
+
* `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
71
|
+
|
|
72
|
+
## Token
|
|
73
|
+
|
|
74
|
+
Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
75
|
+
|
|
76
|
+
### Properties
|
|
77
|
+
|
|
78
|
+
* `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
79
|
+
|
|
58
80
|
## setAttribute
|
|
59
81
|
|
|
60
82
|
Set Object attribute.
|
|
@@ -88,7 +110,15 @@ The name may be a property path like 'a.b.c <='.
|
|
|
88
110
|
* `object` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
|
|
89
111
|
* `expression` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
90
112
|
|
|
91
|
-
Returns **\[any, [
|
|
113
|
+
Returns **\[any, [Token](#token)]** value associated with the given property name
|
|
114
|
+
|
|
115
|
+
## createToken
|
|
116
|
+
|
|
117
|
+
### Parameters
|
|
118
|
+
|
|
119
|
+
* `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
120
|
+
|
|
121
|
+
Returns **[Token](#token)** 
|
|
92
122
|
|
|
93
123
|
## tokens
|
|
94
124
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pacc",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"types": "./types/attribute.d.mts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
-
"
|
|
12
|
-
"
|
|
11
|
+
"default": "./src/attribute.mjs",
|
|
12
|
+
"types": "./types/attribute.d.mts"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"description": "property path utils",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"typescript": "^5.3.3"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
43
|
-
"node": ">=20.11.
|
|
43
|
+
"node": ">=20.11.1"
|
|
44
44
|
},
|
|
45
45
|
"repository": {
|
|
46
46
|
"type": "git",
|
package/src/attribute.mjs
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
* @typedef {Object} AttributeDefinition
|
|
3
3
|
*
|
|
4
4
|
* @property {string} type
|
|
5
|
+
* @property {boolean} isKey
|
|
5
6
|
* @property {boolean} writable
|
|
7
|
+
* @property {boolean} mandatory
|
|
6
8
|
* @property {boolean} [private] should the value be shown
|
|
7
9
|
* @property {string} [depends] name of an attribute we depend on
|
|
8
10
|
* @property {string[]} additionalAttributes extra attributes that are present in case our attribute is set
|
|
@@ -10,7 +12,12 @@
|
|
|
10
12
|
* @property {any} [default] the default value
|
|
11
13
|
* @property {Function} [set] set the value
|
|
12
14
|
* @property {Function} [get] get the value can be used to calculate default values
|
|
13
|
-
* @property {string[]|string} [env] environment variable
|
|
15
|
+
* @property {string[]|string} [env] environment variable(s) used to provide the value
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {Object} Token
|
|
20
|
+
* @property {string} str
|
|
14
21
|
*/
|
|
15
22
|
|
|
16
23
|
import {
|
package/src/tokens.mjs
CHANGED
package/types/attribute.d.mts
CHANGED
|
@@ -25,7 +25,9 @@ export function getAttributeAndOperator(object: any, expression: string): [any,
|
|
|
25
25
|
export * from "./tokens.mjs";
|
|
26
26
|
export type AttributeDefinition = {
|
|
27
27
|
type: string;
|
|
28
|
+
isKey: boolean;
|
|
28
29
|
writable: boolean;
|
|
30
|
+
mandatory: boolean;
|
|
29
31
|
/**
|
|
30
32
|
* should the value be shown
|
|
31
33
|
*/
|
|
@@ -52,7 +54,10 @@ export type AttributeDefinition = {
|
|
|
52
54
|
*/
|
|
53
55
|
get?: Function;
|
|
54
56
|
/**
|
|
55
|
-
* environment variable
|
|
57
|
+
* environment variable(s) used to provide the value
|
|
56
58
|
*/
|
|
57
59
|
env?: string[] | string;
|
|
58
60
|
};
|
|
61
|
+
export type Token = {
|
|
62
|
+
str: string;
|
|
63
|
+
};
|