Skip to content

Commit

Permalink
interp: Move _decode_value to value.jq
Browse files Browse the repository at this point in the history
  • Loading branch information
wader committed Nov 29, 2021
1 parent 8e5442f commit afb1050
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 0 additions & 10 deletions pkg/interp/internal.jq
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,6 @@ def _eval($expr; $filename; f; on_error; on_compile_error):
def _is_scalar:
type |. != "array" and . != "object";

# TODO: error value preview
def _expected_decode_value:
error("expected a decode value but got: \(. | type) (\(. | tostring))");
# TODO: helper? _is_decode_value?
def _decode_value(f; ef):
if _is_decode_value then f
else ef
end;
def _decode_value(f): _decode_value(f; _expected_decode_value);

def _is_context_canceled_error: . == "context canceled";

def _error_str: "error: \(.)";
Expand Down
10 changes: 10 additions & 0 deletions pkg/interp/value.jq
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# TODO: error value preview
def _expected_decode_value:
error("expected a decode value but got: \(. | type) (\(. | tostring))");
# TODO: helper? _is_decode_value?
def _decode_value(f; ef):
if _is_decode_value then f
else ef
end;
def _decode_value(f): _decode_value(f; _expected_decode_value);

# null input means done, otherwise {approx_read_bytes: 123, total_size: 123}
# TODO: decode provide even more detailed progress, post-process sort etc?
def _decode_progress:
Expand Down

0 comments on commit afb1050

Please sign in to comment.