Skip to content

Commit 5a91556

Browse files
authored
[jq/en] Fix typos (#5237)
1 parent 26b5b3a commit 5a91556

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

jq.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ category: tool
33
name: jq
44
contributors:
55
- ["Jack Kuan", "https://github.com/kjkuan"]
6+
- ["Azeem Sajid", "https://github.com/iamazeem"]
67
filename: learnjq.sh
78
---
89

@@ -161,7 +162,7 @@ jq -rn '"1 + 2 = \(1+2)"'
161162

162163

163164
# The `-r` option is most useful for generating text outputs to be processed
164-
# down in a shell pipeline, especially when combined with an intepolated
165+
# down in a shell pipeline, especially when combined with an interpolated
165166
# string that is prefixed the `@sh` prefix operator.
166167
#
167168
# The `@sh` operator escapes the outputs of `\(...)` inside a string with
@@ -252,7 +253,7 @@ jq -n '[2*3, 8-1, 16/2], {("tw" + "o"): (1 + 1)}'
252253
#
253254
jq -n '{ key_1: "value1" }'
254255

255-
# If a JSON object's key's value is ommited, it is looked up in the current
256+
# If a JSON object's key's value is omitted, it is looked up in the current
256257
# input using the key: (see next example for the meaning of `... | ...`)
257258
#
258259
jq -n '{c: 3} | {a: 1, "b", c}'
@@ -384,7 +385,7 @@ jq -n '"abc" | .name? // "unknown"' # => "unknown"
384385

385386

386387
# Strings and arrays can be sliced with the same syntax (`[i:j]`, but no
387-
# steppings) and semantic as found in the Python programming language:
388+
# stepping) and semantic as found in the Python programming language:
388389
#
389390
# 0 1 2 3 4 5 ... infinite
390391
# array = ["a", "b", "c", "d"]
@@ -397,7 +398,7 @@ jq -n '["Peter", "Jerry", "Tom"][:1+1]' # => ["Peter", "Jerry"]
397398
jq -n '["Peter", "Jerry", "Tom"][1:99]' # => ["Jerry", "Tom"]
398399

399400

400-
# If the lookup index or key is ommited then jq iterates through
401+
# If the lookup index or key is omitted then jq iterates through
401402
# the collection, generating one output value from each iteration.
402403
#
403404
# These examples produce the same outputs.
@@ -481,7 +482,7 @@ jq -n '1, 2, 3, 4, 5 | select(. % 2 != 0)' # NOTE: % gives the remainder.
481482

482483

483484
# Function arguments in jq are passed with call-by-name semantic, which
484-
# means, an argument is not evaulated at call site, but instead, is
485+
# means, an argument is not evaluated at call site, but instead, is
485486
# treated as a lambda expression with the calling context of the call
486487
# site as its scope for variable and function references used in the
487488
# expression.
@@ -684,7 +685,7 @@ jq -n '[{a: 1, b: {c: 3}}, {b: 2, c: 4}] | add'
684685

685686

686687
# jq provides a special syntax for writing an expression that reduces
687-
# the outputs generated by a given expresion to a single value.
688+
# the outputs generated by a given expression to a single value.
688689
# It has this form:
689690
#
690691
# reduce outputs_expr as $var (initial_value; reduction_expr)
@@ -789,7 +790,7 @@ EOF
789790
# c's total is 12
790791

791792

792-
# jq supports destructing during varible binding. This lets you extract values
793+
# jq supports destructing during variable binding. This lets you extract values
793794
# from an array or an object and bind them to variables.
794795
#
795796
jq -n '[range(5)] | . as [$first, $second] | $second'
@@ -822,7 +823,7 @@ jq -n '{ name: "Tom", numbers: [1, 2, 3], age: 32}
822823
jq -n '.a = 1 | .b = .a + 1' # => {"a": 1, "b": 2}
823824

824825
# Note that input is `null` due to `jq -n`, so `.` is `null` in the first
825-
# filter, and assiging to a key under `null` turns it into an object with
826+
# filter, and assigning to a key under `null` turns it into an object with
826827
# the key. The same input (now an object) then gets piped to the next filter,
827828
# which then sets the `b` key to the value of the `a` key plus `1`, which is `2`.
828829
#
@@ -885,16 +886,16 @@ jq -n '
885886
# Output:
886887
# 9
887888

888-
# Some notes about function definitons:
889+
# Some notes about function definitions:
889890
#
890891
# - Functions are usually defined at the beginning, so that they are available
891892
# to the rest of the jq program.
892893
#
893-
# - Each function definion should end with a `;` (semicolon).
894+
# - Each function definition should end with a `;` (semicolon).
894895
#
895896
# - It's also possible to define a function within another, though it's not shown here.
896897
#
897-
# - Function parameters are separated by `;` (semicolor). This is consistent with
898+
# - Function parameters are separated by `;` (semicolon). This is consistent with
898899
# passing multiple arguments when calling a function.
899900
#
900901
# - A function can call itself; in fact, jq has TCO (Tail Call Optimization).

0 commit comments

Comments
 (0)