@optique/core 0.1.0 → 0.1.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/parser.cjs +15 -0
- package/dist/parser.js +15 -0
- package/package.json +1 -1
package/dist/parser.cjs
CHANGED
|
@@ -579,6 +579,21 @@ function object(labelOrParsers, maybeParsers) {
|
|
|
579
579
|
};
|
|
580
580
|
else if (!result.success && error.consumed < result.consumed) error = result;
|
|
581
581
|
}
|
|
582
|
+
if (context.buffer.length === 0) {
|
|
583
|
+
let allCanComplete = true;
|
|
584
|
+
for (const [field, parser] of parserPairs) {
|
|
585
|
+
const completeResult = parser.complete(context.state[field]);
|
|
586
|
+
if (!completeResult.success) {
|
|
587
|
+
allCanComplete = false;
|
|
588
|
+
break;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
if (allCanComplete) return {
|
|
592
|
+
success: true,
|
|
593
|
+
next: context,
|
|
594
|
+
consumed: []
|
|
595
|
+
};
|
|
596
|
+
}
|
|
582
597
|
return {
|
|
583
598
|
...error,
|
|
584
599
|
success: false
|
package/dist/parser.js
CHANGED
|
@@ -579,6 +579,21 @@ function object(labelOrParsers, maybeParsers) {
|
|
|
579
579
|
};
|
|
580
580
|
else if (!result.success && error.consumed < result.consumed) error = result;
|
|
581
581
|
}
|
|
582
|
+
if (context.buffer.length === 0) {
|
|
583
|
+
let allCanComplete = true;
|
|
584
|
+
for (const [field, parser] of parserPairs) {
|
|
585
|
+
const completeResult = parser.complete(context.state[field]);
|
|
586
|
+
if (!completeResult.success) {
|
|
587
|
+
allCanComplete = false;
|
|
588
|
+
break;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
if (allCanComplete) return {
|
|
592
|
+
success: true,
|
|
593
|
+
next: context,
|
|
594
|
+
consumed: []
|
|
595
|
+
};
|
|
596
|
+
}
|
|
582
597
|
return {
|
|
583
598
|
...error,
|
|
584
599
|
success: false
|