1
1
mirror of https://github.com/wader/fq.git synced 2024-12-24 22:05:31 +03:00

doc: Move up and update differences jq section a bit

This commit is contained in:
Mattias Wadman 2023-08-22 13:20:50 +02:00
parent 15d894ecb3
commit 406f3926e9

View File

@ -337,7 +337,18 @@ single argument `1, 2` (a lambda expression that outputs `1` and then outputs `2
achieved.
- Expressions have one implicit input and output value. This how pipelines like `1 | . * 2` work.
## Types specific to fq
## Differences to jq
- All [gojq's differences to jq](https://github.com/itchyny/gojq#difference-to-jq).
Notably it adds support for arbitrary-precision integers.
- Supports raw strings using back-ticks. <code>\`\\(1234)\u1234\`</code> results in the string `"\\(1234)\\u1234"`.
- Supports hexadecimal `0xab`, octal `0o77` and binary `0b101` integer literals. Also support grouping using underscore `0xaa_bb_cc_dd`.
- Try include using a ending question mark `include "file?";` that doesn't fail if file is missing or has errors.
- Some values can act as an object with keys even when it's an array, number etc.
- There can be keys hidden from `keys` and `[]`.
- Some values are readonly and can't be updated or will convert to JSON on update.
### Types specific to fq
fq has two additional types compared to jq, decode value and binary. In standard jq expressions they will in most cases behave as some standard jq type.
@ -850,16 +861,6 @@ fq can be used as a script interpreter:
[.frames[].header | .sample_count / .sample_rate] | add
```
## Differences to jq
- [gojq's differences to jq](https://github.com/itchyny/gojq#difference-to-jq),
notable is support for arbitrary-precision integers.
- Supports hexadecimal `0xab`, octal `0o77` and binary `0b101` integer literals.
- Try include `include "file?";` that doesn't fail if file is missing or has errors.
- Some values can act as an object with keys even when it's an array, number etc.
- There can be keys hidden from `keys` and `[]`.
- Some values are readonly and can't be updated.
## Decoded values
When decoding something, using `decode` or `mp3` etc, you a decode value is returned. They behave like