pacc 3.1.6 → 3.1.7
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 +148 -24
- package/package.json +6 -6
- package/src/tokens.mjs +3 -1
package/README.md
CHANGED
|
@@ -29,20 +29,45 @@ const result = getAttribute({ a: [0,{ b: 4 }]}, "a[1].b");
|
|
|
29
29
|
|
|
30
30
|
* [AttributeDefinition](#attributedefinition)
|
|
31
31
|
* [Properties](#properties)
|
|
32
|
-
* [
|
|
33
|
-
|
|
34
|
-
* [Token](#token-1)
|
|
35
|
-
* [Properties](#properties-2)
|
|
36
|
-
* [setAttribute](#setattribute)
|
|
32
|
+
* [tokens](#tokens)
|
|
33
|
+
* [tokens](#tokens-1)
|
|
37
34
|
* [Parameters](#parameters)
|
|
38
|
-
* [
|
|
35
|
+
* [setAttribute](#setattribute)
|
|
39
36
|
* [Parameters](#parameters-1)
|
|
40
|
-
* [
|
|
37
|
+
* [getAttribute](#getattribute)
|
|
41
38
|
* [Parameters](#parameters-2)
|
|
42
|
-
* [
|
|
39
|
+
* [getAttributeAndOperator](#getattributeandoperator)
|
|
43
40
|
* [Parameters](#parameters-3)
|
|
44
|
-
* [
|
|
41
|
+
* [Token](#token)
|
|
42
|
+
* [Properties](#properties-1)
|
|
43
|
+
* [createToken](#createtoken)
|
|
45
44
|
* [Parameters](#parameters-4)
|
|
45
|
+
* [PLUS](#plus)
|
|
46
|
+
* [MINUS](#minus)
|
|
47
|
+
* [STAR](#star)
|
|
48
|
+
* [DIVIDE](#divide)
|
|
49
|
+
* [NOT](#not)
|
|
50
|
+
* [NOT\_EQUAL](#not_equal)
|
|
51
|
+
* [GREATER](#greater)
|
|
52
|
+
* [GREATER\_EQUAL](#greater_equal)
|
|
53
|
+
* [LESS](#less)
|
|
54
|
+
* [LESS\_EQUAL](#less_equal)
|
|
55
|
+
* [EQUAL](#equal)
|
|
56
|
+
* [OPEN\_ROUND](#open_round)
|
|
57
|
+
* [CLOSE\_ROUND](#close_round)
|
|
58
|
+
* [OPEN\_BRACKET](#open_bracket)
|
|
59
|
+
* [CLOSE\_BRACKET](#close_bracket)
|
|
60
|
+
* [OPEN\_CURLY](#open_curly)
|
|
61
|
+
* [CLOSE\_CURLY](#close_curly)
|
|
62
|
+
* [QUESTION](#question)
|
|
63
|
+
* [COLON](#colon)
|
|
64
|
+
* [SEMICOLON](#semicolon)
|
|
65
|
+
* [COMMA](#comma)
|
|
66
|
+
* [DOT](#dot)
|
|
67
|
+
* [AMPERSAND](#ampersand)
|
|
68
|
+
* [DOUBLE\_AMPERSAND](#double_ampersand)
|
|
69
|
+
* [BAR](#bar)
|
|
70
|
+
* [DOUBLE\_BAR](#double_bar)
|
|
46
71
|
|
|
47
72
|
## AttributeDefinition
|
|
48
73
|
|
|
@@ -57,26 +82,21 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
|
|
|
57
82
|
* `private` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** should the value be shown
|
|
58
83
|
* `depends` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** name of an attribute we depend on
|
|
59
84
|
* `additionalAttributes` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** extra attributes that are present in case our attribute is set
|
|
85
|
+
* `description` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** human readable
|
|
60
86
|
* `default` **any?** the default value
|
|
61
87
|
* `set` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** set the value
|
|
62
88
|
* `get` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** get the value can be used to calculate default values
|
|
63
89
|
* `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
|
|
64
90
|
|
|
65
|
-
##
|
|
66
|
-
|
|
67
|
-
Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
68
|
-
|
|
69
|
-
### Properties
|
|
70
|
-
|
|
71
|
-
* `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
91
|
+
## tokens
|
|
72
92
|
|
|
73
|
-
##
|
|
93
|
+
## tokens
|
|
74
94
|
|
|
75
|
-
|
|
95
|
+
Split property path into tokens
|
|
76
96
|
|
|
77
|
-
###
|
|
97
|
+
### Parameters
|
|
78
98
|
|
|
79
|
-
* `
|
|
99
|
+
* `string` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
80
100
|
|
|
81
101
|
## setAttribute
|
|
82
102
|
|
|
@@ -113,6 +133,14 @@ The name may be a property path like 'a.b.c <='.
|
|
|
113
133
|
|
|
114
134
|
Returns **\[any, [Token](#token)]** value associated with the given property name
|
|
115
135
|
|
|
136
|
+
## Token
|
|
137
|
+
|
|
138
|
+
Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
139
|
+
|
|
140
|
+
### Properties
|
|
141
|
+
|
|
142
|
+
* `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
143
|
+
|
|
116
144
|
## createToken
|
|
117
145
|
|
|
118
146
|
### Parameters
|
|
@@ -121,13 +149,109 @@ Returns **\[any, [Token](#token)]** value associated with the given property nam
|
|
|
121
149
|
|
|
122
150
|
Returns **[Token](#token)** 
|
|
123
151
|
|
|
124
|
-
##
|
|
152
|
+
## PLUS
|
|
125
153
|
|
|
126
|
-
|
|
154
|
+
Type: [Token](#token)
|
|
127
155
|
|
|
128
|
-
|
|
156
|
+
## MINUS
|
|
129
157
|
|
|
130
|
-
|
|
158
|
+
Type: [Token](#token)
|
|
159
|
+
|
|
160
|
+
## STAR
|
|
161
|
+
|
|
162
|
+
Type: [Token](#token)
|
|
163
|
+
|
|
164
|
+
## DIVIDE
|
|
165
|
+
|
|
166
|
+
Type: [Token](#token)
|
|
167
|
+
|
|
168
|
+
## NOT
|
|
169
|
+
|
|
170
|
+
Type: [Token](#token)
|
|
171
|
+
|
|
172
|
+
## NOT\_EQUAL
|
|
173
|
+
|
|
174
|
+
Type: [Token](#token)
|
|
175
|
+
|
|
176
|
+
## GREATER
|
|
177
|
+
|
|
178
|
+
Type: [Token](#token)
|
|
179
|
+
|
|
180
|
+
## GREATER\_EQUAL
|
|
181
|
+
|
|
182
|
+
Type: [Token](#token)
|
|
183
|
+
|
|
184
|
+
## LESS
|
|
185
|
+
|
|
186
|
+
Type: [Token](#token)
|
|
187
|
+
|
|
188
|
+
## LESS\_EQUAL
|
|
189
|
+
|
|
190
|
+
Type: [Token](#token)
|
|
191
|
+
|
|
192
|
+
## EQUAL
|
|
193
|
+
|
|
194
|
+
Type: [Token](#token)
|
|
195
|
+
|
|
196
|
+
## OPEN\_ROUND
|
|
197
|
+
|
|
198
|
+
Type: [Token](#token)
|
|
199
|
+
|
|
200
|
+
## CLOSE\_ROUND
|
|
201
|
+
|
|
202
|
+
Type: [Token](#token)
|
|
203
|
+
|
|
204
|
+
## OPEN\_BRACKET
|
|
205
|
+
|
|
206
|
+
Type: [Token](#token)
|
|
207
|
+
|
|
208
|
+
## CLOSE\_BRACKET
|
|
209
|
+
|
|
210
|
+
Type: [Token](#token)
|
|
211
|
+
|
|
212
|
+
## OPEN\_CURLY
|
|
213
|
+
|
|
214
|
+
Type: [Token](#token)
|
|
215
|
+
|
|
216
|
+
## CLOSE\_CURLY
|
|
217
|
+
|
|
218
|
+
Type: [Token](#token)
|
|
219
|
+
|
|
220
|
+
## QUESTION
|
|
221
|
+
|
|
222
|
+
Type: [Token](#token)
|
|
223
|
+
|
|
224
|
+
## COLON
|
|
225
|
+
|
|
226
|
+
Type: [Token](#token)
|
|
227
|
+
|
|
228
|
+
## SEMICOLON
|
|
229
|
+
|
|
230
|
+
Type: [Token](#token)
|
|
231
|
+
|
|
232
|
+
## COMMA
|
|
233
|
+
|
|
234
|
+
Type: [Token](#token)
|
|
235
|
+
|
|
236
|
+
## DOT
|
|
237
|
+
|
|
238
|
+
Type: [Token](#token)
|
|
239
|
+
|
|
240
|
+
## AMPERSAND
|
|
241
|
+
|
|
242
|
+
Type: [Token](#token)
|
|
243
|
+
|
|
244
|
+
## DOUBLE\_AMPERSAND
|
|
245
|
+
|
|
246
|
+
Type: [Token](#token)
|
|
247
|
+
|
|
248
|
+
## BAR
|
|
249
|
+
|
|
250
|
+
Type: [Token](#token)
|
|
251
|
+
|
|
252
|
+
## DOUBLE\_BAR
|
|
253
|
+
|
|
254
|
+
Type: [Token](#token)
|
|
131
255
|
|
|
132
256
|
# install
|
|
133
257
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pacc",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.7",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
"lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"ava": "^6.1.
|
|
37
|
-
"browser-ava": "^2.2.
|
|
36
|
+
"ava": "^6.1.3",
|
|
37
|
+
"browser-ava": "^2.2.13",
|
|
38
38
|
"c8": "^9.1.0",
|
|
39
39
|
"documentation": "^14.0.3",
|
|
40
|
-
"semantic-release": "^23.0.
|
|
41
|
-
"typescript": "^5.4.
|
|
40
|
+
"semantic-release": "^23.0.8",
|
|
41
|
+
"typescript": "^5.4.5"
|
|
42
42
|
},
|
|
43
43
|
"engines": {
|
|
44
|
-
"node": ">=20.
|
|
44
|
+
"node": ">=20.13.0"
|
|
45
45
|
},
|
|
46
46
|
"repository": {
|
|
47
47
|
"type": "git",
|
package/src/tokens.mjs
CHANGED
|
@@ -56,8 +56,10 @@ export function* tokens(string) {
|
|
|
56
56
|
switch (state) {
|
|
57
57
|
case "string-escaping-hex":
|
|
58
58
|
hex += c;
|
|
59
|
+
// @ts-ignore
|
|
59
60
|
if (hex.length === 4) {
|
|
60
|
-
|
|
61
|
+
// @ts-ignore
|
|
62
|
+
buffer += String.fromCharCode(parseInt(hex, 16));
|
|
61
63
|
state = "string";
|
|
62
64
|
}
|
|
63
65
|
continue;
|