pacc 4.15.0 → 4.15.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 +5 -5
- package/package.json +1 -1
- package/src/expression.mjs +7 -3
- package/src/properties.mjs +2 -2
- package/types/properties.d.mts +1 -1
package/README.md
CHANGED
|
@@ -105,11 +105,11 @@ const result = getAttribute({ a: [0,{ b: 4 }]}, "a[1].b");
|
|
|
105
105
|
* [DIVIDE](#divide)
|
|
106
106
|
* [NOT](#not)
|
|
107
107
|
* [NOT\_EQUAL](#not_equal)
|
|
108
|
+
* [EQUAL](#equal)
|
|
108
109
|
* [GREATER](#greater)
|
|
109
110
|
* [GREATER\_EQUAL](#greater_equal)
|
|
110
111
|
* [LESS](#less)
|
|
111
112
|
* [LESS\_EQUAL](#less_equal)
|
|
112
|
-
* [EQUAL](#equal)
|
|
113
113
|
* [OPEN\_ROUND](#open_round)
|
|
114
114
|
* [CLOSE\_ROUND](#close_round)
|
|
115
115
|
* [OPEN\_BRACKET](#open_bracket)
|
|
@@ -491,6 +491,10 @@ Type: [Token](#token)
|
|
|
491
491
|
|
|
492
492
|
Type: [Token](#token)
|
|
493
493
|
|
|
494
|
+
## EQUAL
|
|
495
|
+
|
|
496
|
+
Type: [Token](#token)
|
|
497
|
+
|
|
494
498
|
## GREATER
|
|
495
499
|
|
|
496
500
|
Type: [Token](#token)
|
|
@@ -507,10 +511,6 @@ Type: [Token](#token)
|
|
|
507
511
|
|
|
508
512
|
Type: [Token](#token)
|
|
509
513
|
|
|
510
|
-
## EQUAL
|
|
511
|
-
|
|
512
|
-
Type: [Token](#token)
|
|
513
|
-
|
|
514
514
|
## OPEN\_ROUND
|
|
515
515
|
|
|
516
516
|
Type: [Token](#token)
|
package/package.json
CHANGED
package/src/expression.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
tokens,
|
|
3
2
|
DOT,
|
|
4
3
|
OPEN_ROUND,
|
|
5
4
|
CLOSE_ROUND,
|
|
@@ -67,6 +66,7 @@ export function parse(context) {
|
|
|
67
66
|
case "string":
|
|
68
67
|
return { path: [token] };
|
|
69
68
|
case "boolean":
|
|
69
|
+
case "bigint":
|
|
70
70
|
case "number":
|
|
71
71
|
return token;
|
|
72
72
|
}
|
|
@@ -80,6 +80,7 @@ export function parse(context) {
|
|
|
80
80
|
const right = expression(token.precedence - 1);
|
|
81
81
|
if (typeof left === typeof right) {
|
|
82
82
|
switch (typeof left) {
|
|
83
|
+
case "bigint":
|
|
83
84
|
case "number":
|
|
84
85
|
case "string":
|
|
85
86
|
switch (token) {
|
|
@@ -97,13 +98,16 @@ export function parse(context) {
|
|
|
97
98
|
return left != right;
|
|
98
99
|
}
|
|
99
100
|
break;
|
|
100
|
-
|
|
101
101
|
case "boolean":
|
|
102
102
|
switch (token) {
|
|
103
103
|
case DOUBLE_BAR:
|
|
104
104
|
return left || right;
|
|
105
105
|
case DOUBLE_AMPERSAND:
|
|
106
106
|
return left && right;
|
|
107
|
+
case EQUAL:
|
|
108
|
+
return left == right;
|
|
109
|
+
case NOT_EQUAL:
|
|
110
|
+
return left != right;
|
|
107
111
|
}
|
|
108
112
|
}
|
|
109
113
|
}
|
|
@@ -118,6 +122,7 @@ export function parse(context) {
|
|
|
118
122
|
const right = expression(token.precedence);
|
|
119
123
|
if (typeof left === typeof right) {
|
|
120
124
|
switch (typeof left) {
|
|
125
|
+
case "bigint":
|
|
121
126
|
case "number":
|
|
122
127
|
switch (token) {
|
|
123
128
|
case PLUS:
|
|
@@ -139,7 +144,6 @@ export function parse(context) {
|
|
|
139
144
|
}
|
|
140
145
|
switch (typeof left) {
|
|
141
146
|
case "number":
|
|
142
|
-
case "boolean":
|
|
143
147
|
right.path.unshift(left);
|
|
144
148
|
return right;
|
|
145
149
|
}
|
package/src/properties.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { convertValue } from "./attributes.mjs";
|
|
|
5
5
|
export function definePropertiesFromAttributes(
|
|
6
6
|
object,
|
|
7
7
|
attributes,
|
|
8
|
-
|
|
8
|
+
initialValues,
|
|
9
9
|
properties = {}
|
|
10
10
|
) {
|
|
11
11
|
const applyLater = {};
|
|
@@ -13,7 +13,7 @@ export function definePropertiesFromAttributes(
|
|
|
13
13
|
for (const [path, attribute] of attributeIterator(attributes)) {
|
|
14
14
|
const name = path.join(".");
|
|
15
15
|
|
|
16
|
-
let value = getAttribute(
|
|
16
|
+
let value = getAttribute(initialValues, name, attribute) ?? initialValues?.[name] ?? attribute.default;
|
|
17
17
|
|
|
18
18
|
if (value !== undefined) {
|
|
19
19
|
if (path.length === 1) {
|
package/types/properties.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function definePropertiesFromAttributes(object: any, attributes: any,
|
|
1
|
+
export function definePropertiesFromAttributes(object: any, attributes: any, initialValues: any, properties?: {}): void;
|