@gabrielbryk/jq-ts 1.3.0 → 1.3.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/dist/index.cjs +21 -2
- package/dist/index.mjs +21 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -864,8 +864,27 @@ var Parser = class {
|
|
|
864
864
|
if (!this.match("RBrace")) {
|
|
865
865
|
do {
|
|
866
866
|
const key = this.parseObjectKey();
|
|
867
|
-
|
|
868
|
-
|
|
867
|
+
let value;
|
|
868
|
+
if (this.match("Colon")) value = this.parseDef(false);
|
|
869
|
+
else if (key.kind === "KeyIdentifier") value = {
|
|
870
|
+
kind: "FieldAccess",
|
|
871
|
+
target: {
|
|
872
|
+
kind: "Identity",
|
|
873
|
+
span: key.span
|
|
874
|
+
},
|
|
875
|
+
field: key.name,
|
|
876
|
+
span: key.span
|
|
877
|
+
};
|
|
878
|
+
else if (key.kind === "KeyString") value = {
|
|
879
|
+
kind: "FieldAccess",
|
|
880
|
+
target: {
|
|
881
|
+
kind: "Identity",
|
|
882
|
+
span: key.span
|
|
883
|
+
},
|
|
884
|
+
field: key.value,
|
|
885
|
+
span: key.span
|
|
886
|
+
};
|
|
887
|
+
else throw this.error(this.peek(), "Expected \":\" after object key");
|
|
869
888
|
entries.push({
|
|
870
889
|
key,
|
|
871
890
|
value
|
package/dist/index.mjs
CHANGED
|
@@ -863,8 +863,27 @@ var Parser = class {
|
|
|
863
863
|
if (!this.match("RBrace")) {
|
|
864
864
|
do {
|
|
865
865
|
const key = this.parseObjectKey();
|
|
866
|
-
|
|
867
|
-
|
|
866
|
+
let value;
|
|
867
|
+
if (this.match("Colon")) value = this.parseDef(false);
|
|
868
|
+
else if (key.kind === "KeyIdentifier") value = {
|
|
869
|
+
kind: "FieldAccess",
|
|
870
|
+
target: {
|
|
871
|
+
kind: "Identity",
|
|
872
|
+
span: key.span
|
|
873
|
+
},
|
|
874
|
+
field: key.name,
|
|
875
|
+
span: key.span
|
|
876
|
+
};
|
|
877
|
+
else if (key.kind === "KeyString") value = {
|
|
878
|
+
kind: "FieldAccess",
|
|
879
|
+
target: {
|
|
880
|
+
kind: "Identity",
|
|
881
|
+
span: key.span
|
|
882
|
+
},
|
|
883
|
+
field: key.value,
|
|
884
|
+
span: key.span
|
|
885
|
+
};
|
|
886
|
+
else throw this.error(this.peek(), "Expected \":\" after object key");
|
|
868
887
|
entries.push({
|
|
869
888
|
key,
|
|
870
889
|
value
|