@port-labs/jq-node-bindings 0.0.13 → 0.0.15-dev1

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.
Files changed (453) hide show
  1. package/README.md +6 -1
  2. package/binding.gyp +41 -19
  3. package/configure +1 -1
  4. package/deps/jq/.gitattributes +12 -0
  5. package/deps/jq/AUTHORS +149 -43
  6. package/deps/jq/COPYING +75 -1
  7. package/deps/jq/ChangeLog +2 -2
  8. package/deps/jq/Makefile.am +106 -65
  9. package/deps/jq/NEWS.md +391 -0
  10. package/deps/jq/README.md +54 -52
  11. package/deps/jq/SECURITY.md +7 -0
  12. package/deps/jq/compile-ios.sh +106 -102
  13. package/deps/jq/configure.ac +72 -59
  14. package/deps/jq/docs/Pipfile +14 -0
  15. package/deps/jq/docs/Pipfile.lock +415 -0
  16. package/deps/jq/docs/README.md +15 -14
  17. package/deps/jq/docs/build_manpage.py +251 -0
  18. package/deps/jq/docs/build_mantests.py +21 -0
  19. package/deps/jq/docs/build_website.py +95 -0
  20. package/deps/jq/docs/content/download/default.yml +249 -0
  21. package/deps/jq/docs/content/index.yml +83 -0
  22. package/deps/jq/docs/content/{3.manual/v1.6 → manual/dev}/manual.yml +992 -452
  23. package/deps/jq/docs/content/{3.manual → manual}/v1.3/manual.yml +105 -116
  24. package/deps/jq/docs/content/{3.manual → manual}/v1.4/manual.yml +122 -129
  25. package/deps/jq/docs/content/{3.manual → manual}/v1.5/manual.yml +313 -262
  26. package/deps/jq/docs/content/{3.manual → manual/v1.6}/manual.yml +407 -332
  27. package/deps/jq/docs/content/manual/v1.7/manual.yml +3697 -0
  28. package/deps/jq/docs/content/tutorial/default.yml +337 -0
  29. package/deps/jq/docs/manual_schema.yml +60 -0
  30. package/deps/jq/docs/public/css/style.css +99 -0
  31. package/deps/jq/docs/public/icon.png +0 -0
  32. package/deps/jq/docs/public/icon.svg +1 -0
  33. package/deps/jq/docs/public/jq.svg +1 -0
  34. package/deps/jq/docs/public/js/manual-search.js +31 -49
  35. package/deps/jq/docs/templates/default.html.j2 +31 -0
  36. package/deps/jq/docs/templates/index.html.j2 +58 -0
  37. package/deps/jq/docs/templates/manual.html.j2 +120 -0
  38. package/deps/jq/docs/templates/shared/_footer.html.j2 +14 -0
  39. package/deps/jq/docs/templates/shared/_head.html.j2 +23 -0
  40. package/deps/jq/docs/templates/shared/_navbar.html.j2 +40 -0
  41. package/deps/jq/docs/validate_manual_schema.py +19 -0
  42. package/deps/jq/jq.1.prebuilt +1102 -294
  43. package/deps/jq/jq.spec +2 -3
  44. package/deps/jq/libjq.pc.in +11 -0
  45. package/deps/jq/m4/ax_pthread.m4 +522 -0
  46. package/deps/jq/modules/oniguruma/.travis.yml +17 -0
  47. package/deps/jq/modules/oniguruma/CMakeLists.txt +206 -41
  48. package/deps/jq/modules/oniguruma/COPYING +23 -25
  49. package/deps/jq/modules/oniguruma/HISTORY +368 -23
  50. package/deps/jq/modules/oniguruma/Makefile.am +61 -7
  51. package/deps/jq/modules/oniguruma/README +34 -20
  52. package/deps/jq/modules/oniguruma/README.md +106 -33
  53. package/deps/jq/modules/oniguruma/README_japanese +183 -0
  54. package/deps/jq/modules/oniguruma/autogen.sh +9 -0
  55. package/deps/jq/modules/oniguruma/cmake/Config.cmake.in +4 -0
  56. package/deps/jq/modules/oniguruma/configure.ac +66 -55
  57. package/deps/jq/modules/oniguruma/doc/API +485 -42
  58. package/deps/jq/modules/oniguruma/doc/API.ja +732 -293
  59. package/deps/jq/modules/oniguruma/doc/CALLOUTS.API +397 -0
  60. package/deps/jq/modules/oniguruma/doc/CALLOUTS.API.ja +393 -0
  61. package/deps/jq/modules/oniguruma/doc/CALLOUTS.BUILTIN +95 -0
  62. package/deps/jq/modules/oniguruma/doc/CALLOUTS.BUILTIN.ja +93 -0
  63. package/deps/jq/modules/oniguruma/doc/FAQ +3 -3
  64. package/deps/jq/modules/oniguruma/doc/FAQ.ja +8 -8
  65. package/deps/jq/modules/oniguruma/doc/RE +223 -63
  66. package/deps/jq/modules/oniguruma/doc/RE.ja +420 -265
  67. package/deps/jq/modules/oniguruma/doc/SYNTAX.md +1091 -0
  68. package/deps/jq/modules/oniguruma/doc/UNICODE_PROPERTIES +840 -697
  69. package/deps/jq/modules/oniguruma/harnesses/ascii_compatible.dict +113 -0
  70. package/deps/jq/modules/oniguruma/harnesses/base.c +749 -0
  71. package/deps/jq/modules/oniguruma/harnesses/deluxe.c +206 -0
  72. package/deps/jq/modules/oniguruma/harnesses/dict_conv.py +72 -0
  73. package/deps/jq/modules/oniguruma/harnesses/fuzzer.options +2 -0
  74. package/deps/jq/modules/oniguruma/harnesses/libfuzzer-onig.cpp +45 -0
  75. package/deps/jq/modules/oniguruma/harnesses/regset.c +392 -0
  76. package/deps/jq/modules/oniguruma/index.html +16 -5
  77. package/deps/jq/modules/oniguruma/index_ja.html +16 -5
  78. package/deps/jq/modules/oniguruma/make_win.bat +5 -0
  79. package/deps/jq/modules/oniguruma/make_win32.bat +5 -3
  80. package/deps/jq/modules/oniguruma/make_win64.bat +5 -3
  81. package/deps/jq/modules/oniguruma/onig-config.cmake.in +80 -0
  82. package/deps/jq/modules/oniguruma/onig-config.in +1 -1
  83. package/deps/jq/modules/oniguruma/oniguruma.pc.cmake.in +1 -1
  84. package/deps/jq/modules/oniguruma/oniguruma.pc.in +0 -1
  85. package/deps/jq/modules/oniguruma/sample/CMakeLists.txt +9 -2
  86. package/deps/jq/modules/oniguruma/sample/Makefile.am +24 -5
  87. package/deps/jq/modules/oniguruma/sample/bug_fix.c +13 -51
  88. package/deps/jq/modules/oniguruma/sample/callback_each_match.c +168 -0
  89. package/deps/jq/modules/oniguruma/sample/callout.c +268 -0
  90. package/deps/jq/modules/oniguruma/sample/count.c +125 -0
  91. package/deps/jq/modules/oniguruma/sample/crnl.c +6 -4
  92. package/deps/jq/modules/oniguruma/sample/echo.c +136 -0
  93. package/deps/jq/modules/oniguruma/sample/encode.c +53 -146
  94. package/deps/jq/modules/oniguruma/sample/listcap.c +18 -10
  95. package/deps/jq/modules/oniguruma/sample/names.c +10 -6
  96. package/deps/jq/modules/oniguruma/sample/posix.c +13 -2
  97. package/deps/jq/modules/oniguruma/sample/regset.c +95 -0
  98. package/deps/jq/modules/oniguruma/sample/scan.c +20 -6
  99. package/deps/jq/modules/oniguruma/sample/simple.c +8 -4
  100. package/deps/jq/modules/oniguruma/sample/sql.c +13 -8
  101. package/deps/jq/modules/oniguruma/sample/syntax.c +11 -10
  102. package/deps/jq/modules/oniguruma/sample/user_property.c +12 -7
  103. package/deps/jq/modules/oniguruma/src/Makefile.am +41 -15
  104. package/deps/jq/modules/oniguruma/src/Makefile.windows +196 -183
  105. package/deps/jq/modules/oniguruma/src/ascii.c +64 -7
  106. package/deps/jq/modules/oniguruma/src/big5.c +25 -15
  107. package/deps/jq/modules/oniguruma/src/config.h.cmake.in +7 -22
  108. package/deps/jq/modules/oniguruma/src/config.h.win32 +56 -84
  109. package/deps/jq/modules/oniguruma/src/config.h.win64 +56 -84
  110. package/deps/jq/modules/oniguruma/src/config.h.windows.in +62 -0
  111. package/deps/jq/modules/oniguruma/src/cp1251.c +14 -8
  112. package/deps/jq/modules/oniguruma/src/euc_jp.c +28 -30
  113. package/deps/jq/modules/oniguruma/src/euc_jp_prop.c +25 -32
  114. package/deps/jq/modules/oniguruma/src/euc_jp_prop.gperf +1 -2
  115. package/deps/jq/modules/oniguruma/src/euc_kr.c +27 -15
  116. package/deps/jq/modules/oniguruma/src/euc_tw.c +40 -17
  117. package/deps/jq/modules/oniguruma/src/gb18030.c +177 -119
  118. package/deps/jq/modules/oniguruma/src/gperf_fold_key_conv.py +12 -8
  119. package/deps/jq/modules/oniguruma/src/gperf_unfold_key_conv.py +8 -6
  120. package/deps/jq/modules/oniguruma/src/iso8859_1.c +92 -91
  121. package/deps/jq/modules/oniguruma/src/iso8859_10.c +13 -29
  122. package/deps/jq/modules/oniguruma/src/iso8859_11.c +4 -2
  123. package/deps/jq/modules/oniguruma/src/iso8859_13.c +13 -33
  124. package/deps/jq/modules/oniguruma/src/iso8859_14.c +13 -30
  125. package/deps/jq/modules/oniguruma/src/iso8859_15.c +13 -34
  126. package/deps/jq/modules/oniguruma/src/iso8859_16.c +13 -29
  127. package/deps/jq/modules/oniguruma/src/iso8859_2.c +13 -29
  128. package/deps/jq/modules/oniguruma/src/iso8859_3.c +13 -33
  129. package/deps/jq/modules/oniguruma/src/iso8859_4.c +13 -32
  130. package/deps/jq/modules/oniguruma/src/iso8859_5.c +16 -23
  131. package/deps/jq/modules/oniguruma/src/iso8859_6.c +4 -2
  132. package/deps/jq/modules/oniguruma/src/iso8859_7.c +14 -29
  133. package/deps/jq/modules/oniguruma/src/iso8859_8.c +4 -2
  134. package/deps/jq/modules/oniguruma/src/iso8859_9.c +13 -33
  135. package/deps/jq/modules/oniguruma/src/koi8.c +14 -27
  136. package/deps/jq/modules/oniguruma/src/koi8_r.c +12 -19
  137. package/deps/jq/modules/oniguruma/src/make_property.sh +21 -0
  138. package/deps/jq/modules/oniguruma/src/make_unicode_egcb.sh +7 -0
  139. package/deps/jq/modules/oniguruma/src/make_unicode_egcb_data.py +267 -0
  140. package/deps/jq/modules/oniguruma/src/make_unicode_fold.sh +25 -11
  141. package/deps/jq/modules/oniguruma/src/make_unicode_fold_data.py +206 -26
  142. package/deps/jq/modules/oniguruma/src/make_unicode_property.sh +19 -10
  143. package/deps/jq/modules/oniguruma/src/make_unicode_property_data.py +474 -375
  144. package/deps/jq/modules/oniguruma/src/make_unicode_wb.sh +7 -0
  145. package/deps/jq/modules/oniguruma/src/make_unicode_wb_data.py +267 -0
  146. package/deps/jq/modules/oniguruma/src/mktable.c +28 -24
  147. package/deps/jq/modules/oniguruma/src/onig_init.c +2 -2
  148. package/deps/jq/modules/oniguruma/src/oniggnu.h +7 -5
  149. package/deps/jq/modules/oniguruma/src/onigposix.h +40 -16
  150. package/deps/jq/modules/oniguruma/src/oniguruma.h +357 -107
  151. package/deps/jq/modules/oniguruma/src/regcomp.c +6214 -3933
  152. package/deps/jq/modules/oniguruma/src/regenc.c +197 -120
  153. package/deps/jq/modules/oniguruma/src/regenc.h +106 -63
  154. package/deps/jq/modules/oniguruma/src/regerror.c +112 -91
  155. package/deps/jq/modules/oniguruma/src/regexec.c +4876 -2010
  156. package/deps/jq/modules/oniguruma/src/regext.c +8 -8
  157. package/deps/jq/modules/oniguruma/src/reggnu.c +13 -17
  158. package/deps/jq/modules/oniguruma/src/regint.h +757 -491
  159. package/deps/jq/modules/oniguruma/src/regparse.c +7204 -3240
  160. package/deps/jq/modules/oniguruma/src/regparse.h +361 -218
  161. package/deps/jq/modules/oniguruma/src/regposerr.c +49 -9
  162. package/deps/jq/modules/oniguruma/src/regposix.c +106 -24
  163. package/deps/jq/modules/oniguruma/src/regsyntax.c +66 -13
  164. package/deps/jq/modules/oniguruma/src/regtrav.c +1 -1
  165. package/deps/jq/modules/oniguruma/src/regversion.c +6 -4
  166. package/deps/jq/modules/oniguruma/src/sjis.c +23 -52
  167. package/deps/jq/modules/oniguruma/src/sjis_prop.c +25 -32
  168. package/deps/jq/modules/oniguruma/src/sjis_prop.gperf +1 -2
  169. package/deps/jq/modules/oniguruma/src/st.c +248 -249
  170. package/deps/jq/modules/oniguruma/src/st.h +4 -5
  171. package/deps/jq/modules/oniguruma/src/unicode.c +869 -294
  172. package/deps/jq/modules/oniguruma/src/unicode_egcb_data.c +1419 -0
  173. package/deps/jq/modules/oniguruma/src/unicode_fold1_key.c +1829 -1300
  174. package/deps/jq/modules/oniguruma/src/unicode_fold2_key.c +32 -9
  175. package/deps/jq/modules/oniguruma/src/unicode_fold3_key.c +32 -9
  176. package/deps/jq/modules/oniguruma/src/unicode_fold_data.c +1210 -984
  177. package/deps/jq/modules/oniguruma/src/unicode_property_data.c +22480 -15198
  178. package/deps/jq/modules/oniguruma/src/unicode_property_data_posix.c +1463 -591
  179. package/deps/jq/modules/oniguruma/src/unicode_unfold_key.c +1958 -1418
  180. package/deps/jq/modules/oniguruma/src/unicode_wb_data.c +1106 -0
  181. package/deps/jq/modules/oniguruma/src/utf16_be.c +90 -49
  182. package/deps/jq/modules/oniguruma/src/utf16_le.c +80 -49
  183. package/deps/jq/modules/oniguruma/src/utf32_be.c +14 -42
  184. package/deps/jq/modules/oniguruma/src/utf32_le.c +13 -40
  185. package/deps/jq/modules/oniguruma/src/utf8.c +33 -78
  186. package/deps/jq/modules/oniguruma/test/CMakeLists.txt +55 -0
  187. package/deps/jq/modules/oniguruma/test/Makefile.am +65 -10
  188. package/deps/jq/modules/oniguruma/test/test.sh +17 -0
  189. package/deps/jq/modules/oniguruma/test/test_back.c +1450 -0
  190. package/deps/jq/modules/oniguruma/test/test_options.c +228 -0
  191. package/deps/jq/modules/oniguruma/test/test_regset.c +466 -0
  192. package/deps/jq/modules/oniguruma/test/test_syntax.c +365 -0
  193. package/deps/jq/modules/oniguruma/test/test_utf8.c +1761 -0
  194. package/deps/jq/modules/oniguruma/test/testc.c +128 -88
  195. package/deps/jq/modules/oniguruma/test/testp.c +613 -0
  196. package/deps/jq/modules/oniguruma/test/testu.c +75 -28
  197. package/deps/jq/modules/oniguruma/tis-ci/stub.c +3 -0
  198. package/deps/jq/modules/oniguruma/tis-ci/test_back.config +26 -0
  199. package/deps/jq/modules/oniguruma/tis-ci/test_regset.config +20 -0
  200. package/deps/jq/modules/oniguruma/tis-ci/test_syntax.config +26 -0
  201. package/deps/jq/modules/oniguruma/tis-ci/test_utf8.config +25 -0
  202. package/deps/jq/modules/oniguruma/tis-ci/testc.config +26 -0
  203. package/deps/jq/modules/oniguruma/tis-ci/testu.config +24 -0
  204. package/deps/jq/modules/oniguruma/tis.config +1336 -0
  205. package/deps/jq/modules/oniguruma/windows/CMakeLists.txt +8 -0
  206. package/deps/jq/modules/oniguruma/windows/testc.c +865 -869
  207. package/deps/jq/scripts/update-website +6 -5
  208. package/deps/jq/scripts/version +10 -7
  209. package/deps/jq/sig/jq-release-new.key +29 -0
  210. package/deps/jq/sig/v1.4/sha256sum.txt +1 -0
  211. package/deps/jq/sig/v1.5/sha256sum.txt +2 -0
  212. package/deps/jq/sig/v1.5rc1/sha256sum.txt +1 -0
  213. package/deps/jq/sig/v1.5rc2/sha256sum.txt +2 -0
  214. package/deps/jq/sig/v1.6/sha256sum.txt +2 -0
  215. package/deps/jq/sig/v1.7/jq-1.7.tar.gz.asc +16 -0
  216. package/deps/jq/sig/v1.7/jq-1.7.zip.asc +16 -0
  217. package/deps/jq/sig/v1.7/jq-linux-amd64.asc +16 -0
  218. package/deps/jq/sig/v1.7/jq-linux-arm64.asc +16 -0
  219. package/deps/jq/sig/v1.7/jq-linux-armel.asc +16 -0
  220. package/deps/jq/sig/v1.7/jq-linux-armhf.asc +16 -0
  221. package/deps/jq/sig/v1.7/jq-linux-i386.asc +16 -0
  222. package/deps/jq/sig/v1.7/jq-linux-mips.asc +16 -0
  223. package/deps/jq/sig/v1.7/jq-linux-mips64.asc +16 -0
  224. package/deps/jq/sig/v1.7/jq-linux-mips64el.asc +16 -0
  225. package/deps/jq/sig/v1.7/jq-linux-mips64r6.asc +16 -0
  226. package/deps/jq/sig/v1.7/jq-linux-mips64r6el.asc +16 -0
  227. package/deps/jq/sig/v1.7/jq-linux-mipsel.asc +16 -0
  228. package/deps/jq/sig/v1.7/jq-linux-mipsr6.asc +16 -0
  229. package/deps/jq/sig/v1.7/jq-linux-mipsr6el.asc +16 -0
  230. package/deps/jq/sig/v1.7/jq-linux-powerpc.asc +16 -0
  231. package/deps/jq/sig/v1.7/jq-linux-ppc64el.asc +16 -0
  232. package/deps/jq/sig/v1.7/jq-linux-riscv64.asc +16 -0
  233. package/deps/jq/sig/v1.7/jq-linux-s390x.asc +16 -0
  234. package/deps/jq/sig/v1.7/jq-macos-amd64.asc +16 -0
  235. package/deps/jq/sig/v1.7/jq-macos-arm64.asc +16 -0
  236. package/deps/jq/sig/v1.7/jq-windows-amd64.exe.asc +16 -0
  237. package/deps/jq/sig/v1.7/jq-windows-i386.exe.asc +16 -0
  238. package/deps/jq/sig/v1.7/sha256sum.txt +23 -0
  239. package/deps/jq/sig/v1.7.1/jq-1.7.1.tar.gz.asc +16 -0
  240. package/deps/jq/sig/v1.7.1/jq-1.7.1.zip.asc +16 -0
  241. package/deps/jq/sig/v1.7.1/jq-linux-amd64.asc +16 -0
  242. package/deps/jq/sig/v1.7.1/jq-linux-arm64.asc +16 -0
  243. package/deps/jq/sig/v1.7.1/jq-linux-armel.asc +16 -0
  244. package/deps/jq/sig/v1.7.1/jq-linux-armhf.asc +16 -0
  245. package/deps/jq/sig/v1.7.1/jq-linux-i386.asc +16 -0
  246. package/deps/jq/sig/v1.7.1/jq-linux-mips.asc +16 -0
  247. package/deps/jq/sig/v1.7.1/jq-linux-mips64.asc +16 -0
  248. package/deps/jq/sig/v1.7.1/jq-linux-mips64el.asc +16 -0
  249. package/deps/jq/sig/v1.7.1/jq-linux-mips64r6.asc +16 -0
  250. package/deps/jq/sig/v1.7.1/jq-linux-mips64r6el.asc +16 -0
  251. package/deps/jq/sig/v1.7.1/jq-linux-mipsel.asc +16 -0
  252. package/deps/jq/sig/v1.7.1/jq-linux-mipsr6.asc +16 -0
  253. package/deps/jq/sig/v1.7.1/jq-linux-mipsr6el.asc +16 -0
  254. package/deps/jq/sig/v1.7.1/jq-linux-powerpc.asc +16 -0
  255. package/deps/jq/sig/v1.7.1/jq-linux-ppc64el.asc +16 -0
  256. package/deps/jq/sig/v1.7.1/jq-linux-riscv64.asc +16 -0
  257. package/deps/jq/sig/v1.7.1/jq-linux-s390x.asc +16 -0
  258. package/deps/jq/sig/v1.7.1/jq-linux64.asc +16 -0
  259. package/deps/jq/sig/v1.7.1/jq-macos-amd64.asc +16 -0
  260. package/deps/jq/sig/v1.7.1/jq-macos-arm64.asc +16 -0
  261. package/deps/jq/sig/v1.7.1/jq-osx-amd64.asc +16 -0
  262. package/deps/jq/sig/v1.7.1/jq-win64.exe.asc +16 -0
  263. package/deps/jq/sig/v1.7.1/jq-windows-amd64.exe.asc +16 -0
  264. package/deps/jq/sig/v1.7.1/jq-windows-i386.exe.asc +16 -0
  265. package/deps/jq/sig/v1.7.1/sha256sum.txt +26 -0
  266. package/deps/jq/sig/v1.7rc1/jq-1.7rc1.tar.gz.asc +16 -0
  267. package/deps/jq/sig/v1.7rc1/jq-1.7rc1.zip.asc +16 -0
  268. package/deps/jq/sig/v1.7rc1/jq-linux-amd64.asc +16 -0
  269. package/deps/jq/sig/v1.7rc1/jq-linux-arm64.asc +16 -0
  270. package/deps/jq/sig/v1.7rc1/jq-linux-armel.asc +16 -0
  271. package/deps/jq/sig/v1.7rc1/jq-linux-armhf.asc +16 -0
  272. package/deps/jq/sig/v1.7rc1/jq-linux-i386.asc +16 -0
  273. package/deps/jq/sig/v1.7rc1/jq-linux-mips.asc +16 -0
  274. package/deps/jq/sig/v1.7rc1/jq-linux-mips64.asc +16 -0
  275. package/deps/jq/sig/v1.7rc1/jq-linux-mips64el.asc +16 -0
  276. package/deps/jq/sig/v1.7rc1/jq-linux-mips64r6.asc +16 -0
  277. package/deps/jq/sig/v1.7rc1/jq-linux-mips64r6el.asc +16 -0
  278. package/deps/jq/sig/v1.7rc1/jq-linux-mipsel.asc +16 -0
  279. package/deps/jq/sig/v1.7rc1/jq-linux-mipsr6.asc +16 -0
  280. package/deps/jq/sig/v1.7rc1/jq-linux-mipsr6el.asc +16 -0
  281. package/deps/jq/sig/v1.7rc1/jq-linux-powerpc.asc +16 -0
  282. package/deps/jq/sig/v1.7rc1/jq-linux-ppc64el.asc +16 -0
  283. package/deps/jq/sig/v1.7rc1/jq-linux-riscv64.asc +16 -0
  284. package/deps/jq/sig/v1.7rc1/jq-linux-s390x.asc +16 -0
  285. package/deps/jq/sig/v1.7rc1/jq-macos-amd64.asc +16 -0
  286. package/deps/jq/sig/v1.7rc1/jq-macos-arm64.asc +16 -0
  287. package/deps/jq/sig/v1.7rc1/jq-windows-amd64.exe.asc +16 -0
  288. package/deps/jq/sig/v1.7rc1/jq-windows-i386.exe.asc +16 -0
  289. package/deps/jq/sig/v1.7rc1/sha256sum.txt +23 -0
  290. package/deps/jq/sig/v1.7rc2/jq-1.7rc2.tar.gz.asc +16 -0
  291. package/deps/jq/sig/v1.7rc2/jq-1.7rc2.zip.asc +16 -0
  292. package/deps/jq/sig/v1.7rc2/jq-linux-amd64.asc +16 -0
  293. package/deps/jq/sig/v1.7rc2/jq-linux-arm64.asc +16 -0
  294. package/deps/jq/sig/v1.7rc2/jq-linux-armel.asc +16 -0
  295. package/deps/jq/sig/v1.7rc2/jq-linux-armhf.asc +16 -0
  296. package/deps/jq/sig/v1.7rc2/jq-linux-i386.asc +16 -0
  297. package/deps/jq/sig/v1.7rc2/jq-linux-mips.asc +16 -0
  298. package/deps/jq/sig/v1.7rc2/jq-linux-mips64.asc +16 -0
  299. package/deps/jq/sig/v1.7rc2/jq-linux-mips64el.asc +16 -0
  300. package/deps/jq/sig/v1.7rc2/jq-linux-mips64r6.asc +16 -0
  301. package/deps/jq/sig/v1.7rc2/jq-linux-mips64r6el.asc +16 -0
  302. package/deps/jq/sig/v1.7rc2/jq-linux-mipsel.asc +16 -0
  303. package/deps/jq/sig/v1.7rc2/jq-linux-mipsr6.asc +16 -0
  304. package/deps/jq/sig/v1.7rc2/jq-linux-mipsr6el.asc +16 -0
  305. package/deps/jq/sig/v1.7rc2/jq-linux-powerpc.asc +16 -0
  306. package/deps/jq/sig/v1.7rc2/jq-linux-ppc64el.asc +16 -0
  307. package/deps/jq/sig/v1.7rc2/jq-linux-riscv64.asc +16 -0
  308. package/deps/jq/sig/v1.7rc2/jq-linux-s390x.asc +16 -0
  309. package/deps/jq/sig/v1.7rc2/jq-macos-amd64.asc +16 -0
  310. package/deps/jq/sig/v1.7rc2/jq-macos-arm64.asc +16 -0
  311. package/deps/jq/sig/v1.7rc2/jq-windows-amd64.exe.asc +16 -0
  312. package/deps/jq/sig/v1.7rc2/jq-windows-i386.exe.asc +16 -0
  313. package/deps/jq/sig/v1.7rc2/sha256sum.txt +23 -0
  314. package/deps/jq/src/builtin.c +537 -343
  315. package/deps/jq/src/builtin.h +18 -0
  316. package/deps/jq/src/builtin.jq +116 -143
  317. package/deps/jq/src/bytecode.h +8 -4
  318. package/deps/jq/src/compile.c +157 -143
  319. package/deps/jq/src/compile.h +3 -4
  320. package/deps/jq/src/decNumber/ICU-license.html +45 -0
  321. package/deps/jq/src/decNumber/decBasic.c +3908 -0
  322. package/deps/jq/src/decNumber/decCommon.c +1835 -0
  323. package/deps/jq/src/decNumber/decContext.c +437 -0
  324. package/deps/jq/src/decNumber/decContext.h +254 -0
  325. package/deps/jq/src/decNumber/decDPD.h +1185 -0
  326. package/deps/jq/src/decNumber/decDouble.c +140 -0
  327. package/deps/jq/src/decNumber/decDouble.h +155 -0
  328. package/deps/jq/src/decNumber/decNumber.c +8143 -0
  329. package/deps/jq/src/decNumber/decNumber.h +182 -0
  330. package/deps/jq/src/decNumber/decNumberLocal.h +757 -0
  331. package/deps/jq/src/decNumber/decPacked.c +220 -0
  332. package/deps/jq/src/decNumber/decPacked.h +52 -0
  333. package/deps/jq/src/decNumber/decQuad.c +135 -0
  334. package/deps/jq/src/decNumber/decQuad.h +177 -0
  335. package/deps/jq/src/decNumber/decSingle.c +71 -0
  336. package/deps/jq/src/decNumber/decSingle.h +86 -0
  337. package/deps/jq/src/decNumber/decimal128.c +553 -0
  338. package/deps/jq/src/decNumber/decimal128.h +81 -0
  339. package/deps/jq/src/decNumber/decimal32.c +476 -0
  340. package/deps/jq/src/decNumber/decimal32.h +81 -0
  341. package/deps/jq/src/decNumber/decimal64.c +839 -0
  342. package/deps/jq/src/decNumber/decimal64.h +83 -0
  343. package/deps/jq/src/decNumber/decnumber.pdf +0 -0
  344. package/deps/jq/src/decNumber/example1.c +38 -0
  345. package/deps/jq/src/decNumber/example2.c +52 -0
  346. package/deps/jq/src/decNumber/example3.c +64 -0
  347. package/deps/jq/src/decNumber/example4.c +61 -0
  348. package/deps/jq/src/decNumber/example5.c +36 -0
  349. package/deps/jq/src/decNumber/example6.c +61 -0
  350. package/deps/jq/src/decNumber/example7.c +35 -0
  351. package/deps/jq/src/decNumber/example8.c +39 -0
  352. package/deps/jq/src/decNumber/readme.txt +81 -0
  353. package/deps/jq/src/exec_stack.h +5 -3
  354. package/deps/jq/src/execute.c +126 -44
  355. package/deps/jq/src/inject_errors.c +0 -2
  356. package/deps/jq/src/jq.h +10 -1
  357. package/deps/jq/src/jq_test.c +222 -11
  358. package/deps/jq/src/jv.c +807 -176
  359. package/deps/jq/src/jv.h +22 -1
  360. package/deps/jq/src/jv_alloc.c +33 -26
  361. package/deps/jq/src/jv_alloc.h +0 -11
  362. package/deps/jq/src/jv_aux.c +153 -67
  363. package/deps/jq/src/jv_dtoa.c +12 -2
  364. package/deps/jq/src/jv_dtoa_tsd.c +51 -0
  365. package/deps/jq/src/jv_dtoa_tsd.h +4 -0
  366. package/deps/jq/src/jv_parse.c +70 -15
  367. package/deps/jq/src/jv_print.c +56 -60
  368. package/deps/jq/src/jv_private.h +7 -0
  369. package/deps/jq/src/jv_thread.h +76 -0
  370. package/deps/jq/src/jv_unicode.c +18 -0
  371. package/deps/jq/src/jv_unicode.h +2 -0
  372. package/deps/jq/src/lexer.c +782 -543
  373. package/deps/jq/src/lexer.h +438 -64
  374. package/deps/jq/src/lexer.l +10 -3
  375. package/deps/jq/src/libm.h +16 -6
  376. package/deps/jq/src/linker.c +97 -40
  377. package/deps/jq/src/locfile.c +2 -1
  378. package/deps/jq/src/main.c +384 -336
  379. package/deps/jq/src/opcode_list.h +5 -2
  380. package/deps/jq/src/parser.c +2260 -1898
  381. package/deps/jq/src/parser.h +115 -98
  382. package/deps/jq/src/parser.y +124 -89
  383. package/deps/jq/src/util.c +854 -55
  384. package/deps/jq/src/util.h +6 -4
  385. package/deps/jq/tests/jq.test +762 -26
  386. package/deps/jq/tests/jq_fuzz_compile.c +27 -0
  387. package/deps/jq/tests/jq_fuzz_execute.cpp +42 -0
  388. package/deps/jq/tests/jq_fuzz_fixed.cpp +297 -0
  389. package/deps/jq/tests/jq_fuzz_load_file.c +28 -0
  390. package/deps/jq/tests/jq_fuzz_parse.c +21 -0
  391. package/deps/jq/tests/jq_fuzz_parse_extended.c +36 -0
  392. package/deps/jq/tests/jq_fuzz_parse_stream.c +21 -0
  393. package/deps/jq/tests/local.supp +14 -0
  394. package/deps/jq/tests/man.test +979 -0
  395. package/deps/jq/tests/manonig.test +76 -0
  396. package/deps/jq/tests/manonigtest +5 -0
  397. package/deps/jq/tests/mantest +1 -2
  398. package/deps/jq/tests/modules/home2/.jq/g.jq +1 -0
  399. package/deps/jq/tests/modules/shadow1.jq +2 -0
  400. package/deps/jq/tests/modules/shadow2.jq +1 -0
  401. package/deps/jq/tests/modules/test_bind_order0.jq +1 -0
  402. package/deps/jq/tests/modules/test_bind_order1.jq +1 -1
  403. package/deps/jq/tests/modules/test_bind_order2.jq +0 -1
  404. package/deps/jq/tests/no-main-program.jq +1 -0
  405. package/deps/jq/tests/onig.test +77 -2
  406. package/deps/jq/tests/setup +7 -2
  407. package/deps/jq/tests/shtest +478 -59
  408. package/deps/jq/tests/uri.test +38 -0
  409. package/deps/jq/tests/uritest +5 -0
  410. package/deps/jq/tests/yes-main-program.jq +2 -0
  411. package/lib/index.js +3 -0
  412. package/lib/jq.js +15 -1
  413. package/lib/templateAsync.js +137 -0
  414. package/package.json +7 -7
  415. package/src/binding.cc +623 -146
  416. package/src/binding.h +3 -4
  417. package/test/santiy-async.test.js +171 -0
  418. package/test/santiy.test.js +2 -2
  419. package/test/template-async.test.js +182 -0
  420. package/test/template.test.js +3 -3
  421. package/deps/jq/.travis.yml +0 -202
  422. package/deps/jq/NEWS +0 -89
  423. package/deps/jq/appveyor.yml +0 -53
  424. package/deps/jq/docs/Gemfile +0 -7
  425. package/deps/jq/docs/Gemfile.lock +0 -63
  426. package/deps/jq/docs/Rakefile +0 -24
  427. package/deps/jq/docs/Rakefile.manual +0 -49
  428. package/deps/jq/docs/Rakefile.website +0 -76
  429. package/deps/jq/docs/content/1.tutorial/default.yml +0 -327
  430. package/deps/jq/docs/content/2.download/default.yml +0 -193
  431. package/deps/jq/docs/content/index/index.yml +0 -73
  432. package/deps/jq/docs/public/css/base.scss +0 -181
  433. package/deps/jq/docs/public/jq.png +0 -0
  434. package/deps/jq/docs/site.yml +0 -9
  435. package/deps/jq/docs/templates/default.liquid +0 -34
  436. package/deps/jq/docs/templates/index.liquid +0 -73
  437. package/deps/jq/docs/templates/manual.liquid +0 -99
  438. package/deps/jq/docs/templates/shared/_footer.liquid +0 -10
  439. package/deps/jq/docs/templates/shared/_head.liquid +0 -17
  440. package/deps/jq/docs/templates/shared/_navbar.liquid +0 -27
  441. package/deps/jq/modules/oniguruma/README.ja +0 -195
  442. package/deps/jq/modules/oniguruma/cmake/dist.cmake +0 -321
  443. package/deps/jq/modules/oniguruma/contributed/libfuzzer-onig.cpp +0 -31
  444. package/deps/jq/modules/oniguruma/dist.info +0 -10
  445. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold1_key.c +0 -2250
  446. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold2_key.c +0 -203
  447. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold3_key.c +0 -113
  448. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold_data.c +0 -1225
  449. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_property_data.c +0 -24742
  450. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_property_data_posix.c +0 -4846
  451. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_unfold_key.c +0 -2571
  452. /package/deps/jq/sig/{jq-release.key → jq-release-old.key} +0 -0
  453. /package/deps/jq/tests/modules/{.jq → home1/.jq} +0 -0
@@ -1,11 +1,6 @@
1
1
  ---
2
2
  headline: jq 1.5 Manual
3
3
 
4
- history: |
5
-
6
- *The manual for the development version of jq can be found
7
- [here](/jq/manual).*
8
-
9
4
  body: |
10
5
 
11
6
  A jq program is a "filter": it takes an input, and produces an
@@ -65,7 +60,7 @@ manpage_epilogue: |
65
60
 
66
61
  Presumably. Report them or discuss them at:
67
62
 
68
- https://github.com/stedolan/jq/issues
63
+ https://github.com/jqlang/jq/issues
69
64
 
70
65
  ## AUTHOR
71
66
 
@@ -78,8 +73,8 @@ sections:
78
73
  jq filters run on a stream of JSON data. The input to jq is
79
74
  parsed as a sequence of whitespace-separated JSON values which
80
75
  are passed through the provided filter one at a time. The
81
- output(s) of the filter are written to standard out, again as a
82
- sequence of whitespace-separated JSON data.
76
+ output(s) of the filter are written to standard output, as a
77
+ sequence of newline-separated JSON data.
83
78
 
84
79
  Note: it is important to mind the shell's quoting rules. As a
85
80
  general rule it's best to always quote (with single-quote
@@ -95,50 +90,24 @@ sections:
95
90
  You can affect how jq reads and writes its input and output
96
91
  using some command-line options:
97
92
 
98
- * `--version`:
99
-
100
- Output the jq version and exit with zero.
101
-
102
- * `--seq`:
103
-
104
- Use the `application/json-seq` MIME type scheme for separating
105
- JSON texts in jq's input and output. This means that an ASCII
106
- RS (record separator) character is printed before each value on
107
- output and an ASCII LF (line feed) is printed after every
108
- output. Input JSON texts that fail to parse are ignored (but
109
- warned about), discarding all subsequent input until the next
110
- RS. This more also parses the output of jq without the `--seq`
111
- option.
112
-
113
- * `--stream`:
114
-
115
- Parse the input in streaming fashion, outputing arrays of path
116
- and leaf values (scalars and empty arrays or empty objects).
117
- For example, `"a"` becomes `[[],"a"]`, and `[[],"a",["b"]]`
118
- becomes `[[0],[]]`, `[[1],"a"]`, and `[[1,0],"b"]`.
119
-
120
- This is useful for processing very large inputs. Use this in
121
- conjunction with filtering and the `reduce` and `foreach` syntax
122
- to reduce large inputs incrementally.
123
-
124
- * `--slurp`/`-s`:
93
+ * `--null-input` / `-n`:
125
94
 
126
- Instead of running the filter for each JSON object in the
127
- input, read the entire input stream into a large array and run
128
- the filter just once.
95
+ Don't read any input at all. Instead, the filter is run once
96
+ using `null` as the input. This is useful when using jq as a
97
+ simple calculator or to construct JSON data from scratch.
129
98
 
130
- * `--raw-input`/`-R`:
99
+ * `--raw-input` / `-R`:
131
100
 
132
101
  Don't parse the input as JSON. Instead, each line of text is
133
102
  passed to the filter as a string. If combined with `--slurp`,
134
103
  then the entire input is passed to the filter as a single long
135
104
  string.
136
105
 
137
- * `--null-input`/`-n`:
106
+ * `--slurp` / `-s`:
138
107
 
139
- Don't read any input at all! Instead, the filter is run once
140
- using `null` as the input. This is useful when using jq as a
141
- simple calculator or to construct JSON data from scratch.
108
+ Instead of running the filter for each JSON object in the
109
+ input, read the entire input stream into a large array and run
110
+ the filter just once.
142
111
 
143
112
  * `--compact-output` / `-c`:
144
113
 
@@ -146,19 +115,16 @@ sections:
146
115
  will result in more compact output by instead putting each
147
116
  JSON object on a single line.
148
117
 
149
- * `--tab`:
150
-
151
- Use a tab for each indentation level instead of two spaces.
152
-
153
- * `--indent n`:
118
+ * `--raw-output` / `-r`:
154
119
 
155
- Use the given number of spaces (no more than 8) for indentation.
120
+ With this option, if the filter's result is a string then it
121
+ will be written directly to standard output rather than being
122
+ formatted as a JSON string with quotes. This can be useful for
123
+ making jq filters talk to non-JSON-based systems.
156
124
 
157
- * `--color-output` / `-C` and `--monochrome-output` / `-M`:
125
+ * `--join-output` / `-j`:
158
126
 
159
- By default, jq outputs colored JSON if writing to a
160
- terminal. You can force it to produce color even if writing to
161
- a pipe or a file using `-C`, and disable color with `-M`.
127
+ Like `-r` but jq won't print a newline after each output.
162
128
 
163
129
  * `--ascii-output` / `-a`:
164
130
 
@@ -168,47 +134,63 @@ sections:
168
134
  ASCII output with every non-ASCII character replaced with the
169
135
  equivalent escape sequence.
170
136
 
171
- * `--unbuffered`
137
+ * `--sort-keys` / `-S`:
138
+
139
+ Output the fields of each object with the keys in sorted order.
140
+
141
+ * `--color-output` / `-C` and `--monochrome-output` / `-M`:
142
+
143
+ By default, jq outputs colored JSON if writing to a
144
+ terminal. You can force it to produce color even if writing to
145
+ a pipe or a file using `-C`, and disable color with `-M`.
146
+
147
+ * `--tab`:
148
+
149
+ Use a tab for each indentation level instead of two spaces.
150
+
151
+ * `--indent n`:
152
+
153
+ Use the given number of spaces (no more than 7) for indentation.
154
+
155
+ * `--unbuffered`:
172
156
 
173
157
  Flush the output after each JSON object is printed (useful if
174
158
  you're piping a slow data source into jq and piping jq's
175
159
  output elsewhere).
176
160
 
177
- * `--sort-keys` / `-S`:
178
-
179
- Output the fields of each object with the keys in sorted order.
161
+ * `--stream`:
180
162
 
181
- * `--raw-output` / `-r`:
163
+ Parse the input in streaming fashion, outputting arrays of path
164
+ and leaf values (scalars and empty arrays or empty objects).
165
+ For example, `"a"` becomes `[[],"a"]`, and `[[],"a",["b"]]`
166
+ becomes `[[0],[]]`, `[[1],"a"]`, and `[[2,0],"b"]`.
182
167
 
183
- With this option, if the filter's result is a string then it
184
- will be written directly to standard output rather than being
185
- formatted as a JSON string with quotes. This can be useful for
186
- making jq filters talk to non-JSON-based systems.
168
+ This is useful for processing very large inputs. Use this in
169
+ conjunction with filtering and the `reduce` and `foreach` syntax
170
+ to reduce large inputs incrementally.
187
171
 
188
- * `--join-output` / `-j`:
172
+ * `--seq`:
189
173
 
190
- Like `-r` but jq won't print a newline after each output.
174
+ Use the `application/json-seq` MIME type scheme for separating
175
+ JSON texts in jq's input and output. This means that an ASCII
176
+ RS (record separator) character is printed before each value on
177
+ output and an ASCII LF (line feed) is printed after every
178
+ output. Input JSON texts that fail to parse are ignored (but
179
+ warned about), discarding all subsequent input until the next
180
+ RS. This mode also parses the output of jq without the `--seq`
181
+ option.
191
182
 
192
183
  * `-f filename` / `--from-file filename`:
193
184
 
194
185
  Read filter from the file rather than from a command line, like
195
186
  awk's -f option. You can also use '#' to make comments.
196
187
 
197
- * `-Ldirectory` / `-L directory`:
188
+ * `-L directory`:
198
189
 
199
190
  Prepend `directory` to the search list for modules. If this
200
191
  option is used then no builtin search list is used. See the
201
192
  section on modules below.
202
193
 
203
- * `-e` / `--exit-status`:
204
-
205
- Sets the exit status of jq to 0 if the last output values was
206
- neither `false` nor `null`, 1 if the last output value was
207
- either `false` or `null`, or 4 if no valid result was ever
208
- produced. Normally jq exits with 2 if there was any usage
209
- problem or system error, 3 if there was a jq program compile
210
- error, or 0 if the jq program ran.
211
-
212
194
  * `--arg name value`:
213
195
 
214
196
  This option passes a value to the jq program as a predefined
@@ -227,7 +209,7 @@ sections:
227
209
 
228
210
  This option reads all the JSON texts in the named file and binds
229
211
  an array of the parsed JSON values to the given global variable.
230
- If you run jq with `--argfile foo bar`, then `$foo` is available
212
+ If you run jq with `--slurpfile foo bar`, then `$foo` is available
231
213
  in the program and has an array whose elements correspond to the
232
214
  texts in the file named `bar`.
233
215
 
@@ -239,6 +221,23 @@ sections:
239
221
  one text, then that is used, else an array of texts is used as
240
222
  in `--slurpfile`.)
241
223
 
224
+ * `--exit-status` / `-e`:
225
+
226
+ Sets the exit status of jq to 0 if the last output value was
227
+ neither `false` nor `null`, 1 if the last output value was
228
+ either `false` or `null`, or 4 if no valid result was ever
229
+ produced. Normally jq exits with 2 if there was any usage
230
+ problem or system error, 3 if there was a jq program compile
231
+ error, or 0 if the jq program ran.
232
+
233
+ * `--version` / `-V`:
234
+
235
+ Output the jq version and exit with zero.
236
+
237
+ * `--help` / `-h`:
238
+
239
+ Output the jq help and exit with zero.
240
+
242
241
  * `--run-tests [filename]`:
243
242
 
244
243
  Runs the tests in the given file or standard input. This must
@@ -247,7 +246,7 @@ sections:
247
246
  program lines followed by one input line, as many lines of
248
247
  output as are expected (one per output), and a terminating empty
249
248
  line. Compilation failure tests start with a line containing
250
- only "%%FAIL", then a line containing the program to compile,
249
+ only `%%FAIL`, then a line containing the program to compile,
251
250
  then a line containing an error message to compare to the
252
251
  actual.
253
252
 
@@ -278,50 +277,49 @@ sections:
278
277
  JSON object (aka dictionary or hash) as input, it produces
279
278
  the value at the key "foo", or null if there's none present.
280
279
 
281
- If the key contains special characters, you need to surround
282
- it with double quotes like this: `."foo$"`.
280
+ If the key contains special characters or starts with a digit,
281
+ you need to surround it with double quotes like this: `."foo$"`.
283
282
 
284
283
  A filter of the form `.foo.bar` is equivalent to `.foo|.bar`.
285
284
 
286
285
  examples:
287
286
  - program: '.foo'
288
287
  input: '{"foo": 42, "bar": "less interesting data"}'
289
- output: [42]
288
+ output: ['42']
290
289
  - program: '.foo'
291
290
  input: '{"notfoo": true, "alsonotfoo": false}'
292
291
  output: ['null']
293
292
  - program: '.["foo"]'
294
293
  input: '{"foo": 42}'
295
- output: [42]
294
+ output: ['42']
296
295
 
297
296
  - title: "`.foo?`"
298
297
  body: |
299
298
 
300
- Just like `.foo`, but does not output even an error when `.`
301
- is not an array or an object.
299
+ Just like `.foo`, but does not output an error when `.` is not an
300
+ object.
302
301
 
303
302
  examples:
304
303
  - program: '.foo?'
305
304
  input: '{"foo": 42, "bar": "less interesting data"}'
306
- output: [42]
305
+ output: ['42']
307
306
  - program: '.foo?'
308
307
  input: '{"notfoo": true, "alsonotfoo": false}'
309
308
  output: ['null']
310
309
  - program: '.["foo"]?'
311
310
  input: '{"foo": 42}'
312
- output: [42]
311
+ output: ['42']
313
312
  - program: '[.foo?]'
314
313
  input: '[1,2]'
315
314
  output: ['[]']
316
315
 
317
- - title: "`.[<string>]`, `.[2]`, `.[10:15]`"
316
+ - title: "`.[<string>]`, `.[<number>]`, `.[<number>:<number>]`"
318
317
  body: |
319
318
 
320
319
  You can also look up fields of an object using syntax like
321
- `.["foo"]` (.foo above is a shorthand version of this). This
322
- one works for arrays as well, if the key is an
323
- integer. Arrays are zero-based (like javascript), so `.[2]`
324
- returns the third element of the array.
320
+ `.["foo"]` (`.foo` above is a shorthand version of this). This
321
+ one works for arrays as well, if the key is an integer. Arrays
322
+ are zero-based, so `.[2]` returns the third element of the array.
325
323
 
326
324
  The `.[10:15]` syntax can be used to return a subarray of an
327
325
  array or substring of a string. The array returned by
@@ -329,7 +327,7 @@ sections:
329
327
  index 10 (inclusive) to index 15 (exclusive). Either index may
330
328
  be negative (in which case it counts backwards from the end of
331
329
  the array), or omitted (in which case it refers to the start
332
- or end of the array).
330
+ or end of the array). Indices are zero-based.
333
331
 
334
332
  The `.[2]` syntax can be used to return the element at the
335
333
  given index. Negative indices are allowed, with -1 referring
@@ -382,7 +380,8 @@ sections:
382
380
  entirely, it will return *all* of the elements of an
383
381
  array. Running `.[]` with the input `[1,2,3]` will produce the
384
382
  numbers as three separate results, rather than as a single
385
- array.
383
+ array. A filter of the form `.foo[]` is equivalent to
384
+ `.foo | .[]`.
386
385
 
387
386
  You can also use this on an object, and it will return all
388
387
  the values of the object.
@@ -398,6 +397,10 @@ sections:
398
397
  input: '[]'
399
398
  output: []
400
399
 
400
+ - program: '.foo[]'
401
+ input: '{"foo":[1,2,3]}'
402
+ output: ['1','2','3']
403
+
401
404
  - program: '.[]'
402
405
  input: '{"a": 1, "b": 1}'
403
406
  output: ['1', '1']
@@ -406,7 +409,8 @@ sections:
406
409
  body: |
407
410
 
408
411
  Like `.[]`, but no errors will be output if . is not an array
409
- or object.
412
+ or object. A filter of the form `.foo[]?` is equivalent to
413
+ `.foo | .[]?`.
410
414
 
411
415
  - title: "`,`"
412
416
  body: |
@@ -456,13 +460,13 @@ sections:
456
460
  hashes with only string keys), and "null".
457
461
 
458
462
  Booleans, null, strings and numbers are written the same way as
459
- in javascript. Just like everything else in jq, these simple
463
+ in JSON. Just like everything else in jq, these simple
460
464
  values take an input and produce an output - `42` is a valid jq
461
465
  expression that takes an input, ignores it, and returns 42
462
466
  instead.
463
467
 
464
468
  entries:
465
- - title: Array construction - `[]`
469
+ - title: "Array construction: `[]`"
466
470
  body: |
467
471
 
468
472
  As in JSON, `[]` is used to construct arrays, as in
@@ -487,7 +491,7 @@ sections:
487
491
  - program: "[.user, .projects[]]"
488
492
  input: '{"user":"stedolan", "projects": ["jq", "wikiflow"]}'
489
493
  output: ['["stedolan", "jq", "wikiflow"]']
490
- - title: Objects - `{}`
494
+ - title: "Objects: `{}`"
491
495
  body: |
492
496
 
493
497
  Like JSON, `{}` is for constructing objects (aka
@@ -548,14 +552,14 @@ sections:
548
552
  - title: Builtin operators and functions
549
553
  body: |
550
554
 
551
- Some jq operator (for instance, `+`) do different things
555
+ Some jq operators (for instance, `+`) do different things
552
556
  depending on the type of their arguments (arrays, numbers,
553
557
  etc.). However, jq never does implicit type conversions. If you
554
558
  try to add a string to an object you'll get an error message and
555
559
  no result.
556
560
 
557
561
  entries:
558
- - title: Addition - `+`
562
+ - title: "Addition: `+`"
559
563
  body: |
560
564
 
561
565
  The operator `+` takes two filters, applies them both
@@ -594,7 +598,7 @@ sections:
594
598
  input: 'null'
595
599
  output: ['{"a": 42, "b": 2, "c": 3}']
596
600
 
597
- - title: Subtraction - `-`
601
+ - title: "Subtraction: `-`"
598
602
  body: |
599
603
 
600
604
  As well as normal arithmetic subtraction on numbers, the `-`
@@ -609,7 +613,7 @@ sections:
609
613
  input: '["xml", "yaml", "json"]'
610
614
  output: ['["json"]']
611
615
 
612
- - title: Multiplication, division, modulo - `*`, `/`, and `%`
616
+ - title: "Multiplication, division, modulo: `*`, `/`, `%`"
613
617
  body: |
614
618
 
615
619
  These infix operators behave as expected when given two numbers.
@@ -628,8 +632,8 @@ sections:
628
632
 
629
633
  examples:
630
634
  - program: '10 / . * 3'
631
- input: 5
632
- output: [6]
635
+ input: '5'
636
+ output: ['6']
633
637
  - program: '. / ", "'
634
638
  input: '"a, b,c,d, e"'
635
639
  output: ['["a","b,c,d","e"]']
@@ -660,7 +664,7 @@ sections:
660
664
  examples:
661
665
  - program: '.[] | length'
662
666
  input: '[[1,2], "string", {"a":2}, null]'
663
- output: [2, 6, 1, 0]
667
+ output: ['2', '6', '1', '0']
664
668
 
665
669
  - title: "`keys`, `keys_unsorted`"
666
670
  body: |
@@ -770,7 +774,7 @@ sections:
770
774
  input: '["foo", "bar", "baz"]'
771
775
  output: ['["foo"]']
772
776
 
773
- - title: "`to_entries`, `from_entries`, `with_entries`"
777
+ - title: "`to_entries`, `from_entries`, `with_entries(f)`"
774
778
  body: |
775
779
 
776
780
  These functions convert between an object and an array of
@@ -779,10 +783,10 @@ sections:
779
783
  includes `{"key": k, "value": v}`.
780
784
 
781
785
  `from_entries` does the opposite conversion, and
782
- `with_entries(foo)` is a shorthand for `to_entries |
783
- map(foo) | from_entries`, useful for doing some operation to
784
- all keys and values of an object. `from_entries` accepts key, Key,
785
- Name, value and Value as keys.
786
+ `with_entries(f)` is a shorthand for `to_entries | map(f) |
787
+ from_entries`, useful for doing some operation to all keys
788
+ and values of an object. `from_entries` accepts `"key"`,
789
+ `"Key"`, `"Name"`, `"value"`, and `"Value"` as keys.
786
790
 
787
791
  examples:
788
792
  - program: 'to_entries'
@@ -799,8 +803,8 @@ sections:
799
803
  - title: "`select(boolean_expression)`"
800
804
  body: |
801
805
 
802
- The function `select(foo)` produces its input unchanged if
803
- `foo` returns true for that input, and produces no output
806
+ The function `select(f)` produces its input unchanged if
807
+ `f` returns true for that input, and produces no output
804
808
  otherwise.
805
809
 
806
810
  It's useful for filtering lists: `[1,2,3] | map(select(. >= 2))`
@@ -838,17 +842,30 @@ sections:
838
842
  examples:
839
843
  - program: '1, empty, 2'
840
844
  input: 'null'
841
- output: [1, 2]
845
+ output: ['1', '2']
842
846
  - program: '[1,2,empty,3]'
843
847
  input: 'null'
844
848
  output: ['[1,2,3]']
845
849
 
846
- - title: "`error(message)`"
850
+ - title: "`error`, `error(message)`"
847
851
  body: |
848
852
 
849
- Produces an error, just like `.a` applied to values other than
850
- null and objects would, but with the given message as the
851
- error's value.
853
+ Produces an error with the input value, or with the message
854
+ given as the argument. Errors can be caught with try/catch;
855
+ see below.
856
+
857
+ When the error value is `null`, it produces nothing and works
858
+ just like `empty`. So `[null | error]` and `[error(null)]` both
859
+ emit `[]`.
860
+
861
+ examples:
862
+ - program: 'try error catch .'
863
+ input: '"error message"'
864
+ output: ['"error message"']
865
+
866
+ - program: 'try error("invalid value: \(.)") catch .'
867
+ input: '42'
868
+ output: ['"invalid value: 42"']
852
869
 
853
870
  - title: "`$__loc__`"
854
871
  body: |
@@ -862,18 +879,18 @@ sections:
862
879
  input: 'null'
863
880
  output: ['"{\"file\":\"<top-level>\",\"line\":1}"']
864
881
 
865
- - title: "`map(x)`, `map_values(x)`"
882
+ - title: "`map(f)`, `map_values(f)`"
866
883
  body: |
867
884
 
868
- For any filter `x`, `map(x)` will run that filter for each
885
+ For any filter `f`, `map(f)` will run that filter for each
869
886
  element of the input array, and return the outputs in a new
870
887
  array. `map(.+1)` will increment each element of an array of numbers.
871
888
 
872
- Similarly, `map_values(x)` will run that filter for each element,
889
+ Similarly, `map_values(f)` will run that filter for each element,
873
890
  but it will return an object when an object is passed.
874
891
 
875
- `map(x)` is equivalent to `[.[] | x]`. In fact, this is how
876
- it's defined. Similarly, `map_values(x)` is defined as `.[] |= x`.
892
+ `map(f)` is equivalent to `[.[] | f]`. In fact, this is how
893
+ it's defined. Similarly, `map_values(f)` is defined as `.[] |= f`.
877
894
 
878
895
  examples:
879
896
  - program: 'map(.+1)'
@@ -891,8 +908,8 @@ sections:
891
908
  (except it does not output the empty list, representing .
892
909
  itself).
893
910
 
894
- `paths(f)` outputs the paths to any values for which `f` is true.
895
- That is, `paths(numbers)` outputs the paths to all numeric
911
+ `paths(f)` outputs the paths to any values for which `f` is `true`.
912
+ That is, `paths(type == "number")` outputs the paths to all numeric
896
913
  values.
897
914
 
898
915
  `leaf_paths` is an alias of `paths(scalars)`; `leaf_paths` is
@@ -902,7 +919,7 @@ sections:
902
919
  - program: '[paths]'
903
920
  input: '[1,[[],{"a":2}]]'
904
921
  output: ['[[0],[1],[1,0],[1,1],[1,1,"a"]]']
905
- - program: '[paths(scalars)]'
922
+ - program: '[paths(type == "number")]'
906
923
  input: '[1,[[],{"a":2}]]'
907
924
  output: ['[[0],[1,1,"a"]]']
908
925
 
@@ -923,7 +940,7 @@ sections:
923
940
  output: ['"abc"']
924
941
  - program: add
925
942
  input: '[1, 2, 3]'
926
- output: [6]
943
+ output: ['6']
927
944
  - program: add
928
945
  input: '[]'
929
946
  output: ["null"]
@@ -1005,12 +1022,12 @@ sections:
1005
1022
  input: '[{"foo": "bar"}, [{"foo": "baz"}]]'
1006
1023
  output: ['[{"foo": "bar"}, {"foo": "baz"}]']
1007
1024
 
1008
- - title: "`range(upto)`, `range(from;upto)` `range(from;upto;by)`"
1025
+ - title: "`range(upto)`, `range(from; upto)`, `range(from; upto; by)`"
1009
1026
  body: |
1010
1027
 
1011
- The `range` function produces a range of numbers. `range(4;10)`
1028
+ The `range` function produces a range of numbers. `range(4; 10)`
1012
1029
  produces 6 numbers, from 4 (inclusive) to 10 (exclusive). The numbers
1013
- are produced as separate outputs. Use `[range(4;10)]` to get a range as
1030
+ are produced as separate outputs. Use `[range(4; 10)]` to get a range as
1014
1031
  an array.
1015
1032
 
1016
1033
  The one argument form generates numbers from 0 to the given
@@ -1023,22 +1040,22 @@ sections:
1023
1040
  with an increment of `by`.
1024
1041
 
1025
1042
  examples:
1026
- - program: 'range(2;4)'
1043
+ - program: 'range(2; 4)'
1027
1044
  input: 'null'
1028
1045
  output: ['2', '3']
1029
- - program: '[range(2;4)]'
1046
+ - program: '[range(2; 4)]'
1030
1047
  input: 'null'
1031
1048
  output: ['[2,3]']
1032
1049
  - program: '[range(4)]'
1033
1050
  input: 'null'
1034
1051
  output: ['[0,1,2,3]']
1035
- - program: '[range(0;10;3)]'
1052
+ - program: '[range(0; 10; 3)]'
1036
1053
  input: 'null'
1037
1054
  output: ['[0,3,6,9]']
1038
- - program: '[range(0;10;-1)]'
1055
+ - program: '[range(0; 10; -1)]'
1039
1056
  input: 'null'
1040
1057
  output: ['[]']
1041
- - program: '[range(0;-5;-1)]'
1058
+ - program: '[range(0; -5; -1)]'
1042
1059
  input: 'null'
1043
1060
  output: ['[0,-1,-2,-3,-4]']
1044
1061
 
@@ -1072,7 +1089,7 @@ sections:
1072
1089
  examples:
1073
1090
  - program: '.[] | tonumber'
1074
1091
  input: '[1, "1"]'
1075
- output: [1, 1]
1092
+ output: ['1', '1']
1076
1093
 
1077
1094
  - title: "`tostring`"
1078
1095
  body: |
@@ -1122,7 +1139,7 @@ sections:
1122
1139
  input: 'null'
1123
1140
  output: ['"number"', '"number"']
1124
1141
 
1125
- - title: "`sort, sort_by(path_expression)`"
1142
+ - title: "`sort`, `sort_by(path_expression)`"
1126
1143
  body: |
1127
1144
 
1128
1145
  The `sort` functions sorts its input, which must be an
@@ -1141,19 +1158,25 @@ sections:
1141
1158
  sorted order), and if their keys are equal then the values
1142
1159
  are compared key by key.
1143
1160
 
1144
- `sort` may be used to sort by a particular field of an
1145
- object, or by applying any jq filter.
1146
-
1147
- `sort_by(foo)` compares two elements by comparing the result of
1148
- `foo` on each element.
1161
+ `sort_by` may be used to sort by a particular field of an
1162
+ object, or by applying any jq filter. `sort_by(f)` compares
1163
+ two elements by comparing the result of `f` on each element.
1164
+ When `f` produces multiple values, it firstly compares the
1165
+ first values, and the second values if the first values are
1166
+ equal, and so on.
1149
1167
 
1150
1168
  examples:
1151
1169
  - program: 'sort'
1152
1170
  input: '[8,3,null,6]'
1153
1171
  output: ['[null,3,6,8]']
1172
+
1154
1173
  - program: 'sort_by(.foo)'
1155
- input: '[{"foo":4, "bar":10}, {"foo":3, "bar":100}, {"foo":2, "bar":1}]'
1156
- output: ['[{"foo":2, "bar":1}, {"foo":3, "bar":100}, {"foo":4, "bar":10}]']
1174
+ input: '[{"foo":4, "bar":10}, {"foo":3, "bar":10}, {"foo":2, "bar":1}]'
1175
+ output: ['[{"foo":2, "bar":1}, {"foo":3, "bar":10}, {"foo":4, "bar":10}]']
1176
+
1177
+ - program: 'sort_by(.foo, .bar)'
1178
+ input: '[{"foo":4, "bar":10}, {"foo":3, "bar":20}, {"foo":2, "bar":1}, {"foo":3, "bar":10}]'
1179
+ output: ['[{"foo":2, "bar":1}, {"foo":3, "bar":10}, {"foo":3, "bar":20}, {"foo":4, "bar":10}]']
1157
1180
 
1158
1181
  - title: "`group_by(path_expression)`"
1159
1182
  body: |
@@ -1280,9 +1303,21 @@ sections:
1280
1303
  - program: 'index(", ")'
1281
1304
  input: '"a,b, cd, efg, hijk"'
1282
1305
  output: ['3']
1306
+ - program: 'index(1)'
1307
+ input: '[0,1,2,1,3,1,4]'
1308
+ output: ['1']
1309
+ - program: 'index([1,2])'
1310
+ input: '[0,1,2,3,1,4,2,5,1,2,6,7]'
1311
+ output: ['1']
1283
1312
  - program: 'rindex(", ")'
1284
1313
  input: '"a,b, cd, efg, hijk"'
1285
1314
  output: ['12']
1315
+ - program: 'rindex(1)'
1316
+ input: '[0,1,2,1,3,1,4]'
1317
+ output: ['5']
1318
+ - program: 'rindex([1,2])'
1319
+ input: '[0,1,2,3,1,4,2,5,1,2,6,7]'
1320
+ output: ['8']
1286
1321
 
1287
1322
  - title: "`inside`"
1288
1323
  body: |
@@ -1416,10 +1451,10 @@ sections:
1416
1451
  Emit a copy of the input string with its alphabetic characters (a-z and A-Z)
1417
1452
  converted to the specified case.
1418
1453
 
1419
- example:
1454
+ examples:
1420
1455
  - program: 'ascii_upcase'
1421
1456
  input: '"useful but not for é"'
1422
- output: '"USEFUL BUT NOT FOR é"'
1457
+ output: ['"USEFUL BUT NOT FOR é"']
1423
1458
 
1424
1459
  - title: "`while(cond; update)`"
1425
1460
  body: |
@@ -1516,11 +1551,8 @@ sections:
1516
1551
  - '1'
1517
1552
 
1518
1553
  - program: 'recurse(. * .; . < 20)'
1519
- input: 2
1520
- output:
1521
- - 2
1522
- - 4
1523
- - 16
1554
+ input: '2'
1555
+ output: ['2', '4', '16']
1524
1556
 
1525
1557
  - title: "`..`"
1526
1558
  body: |
@@ -1560,13 +1592,13 @@ sections:
1560
1592
  - title: "`bsearch(x)`"
1561
1593
  body: |
1562
1594
 
1563
- bsearch(x) conducts a binary search for x in the input
1595
+ `bsearch(x)` conducts a binary search for x in the input
1564
1596
  array. If the input is sorted and contains x, then
1565
- bsearch(x) will return its index in the array; otherwise, if
1597
+ `bsearch(x)` will return its index in the array; otherwise, if
1566
1598
  the array is sorted, it will return (-1 - ix) where ix is an
1567
1599
  insertion point such that the array would still be sorted
1568
1600
  after the insertion of x at ix. If the array is not sorted,
1569
- bsearch(x) will return an integer that is probably of no
1601
+ `bsearch(x)` will return an integer that is probably of no
1570
1602
  interest.
1571
1603
 
1572
1604
  examples:
@@ -1580,7 +1612,7 @@ sections:
1580
1612
  input: '[1,2,3]'
1581
1613
  output: ['[1,2,3,4]']
1582
1614
 
1583
- - title: "String interpolation - `\\(foo)`"
1615
+ - title: "String interpolation: `\\(exp)`"
1584
1616
  body: |
1585
1617
 
1586
1618
  Inside a string, you can put an expression inside parens
@@ -1685,10 +1717,6 @@ sections:
1685
1717
  input: '"This works if x < y"'
1686
1718
  output: ['"This works if x &lt; y"']
1687
1719
 
1688
- # - program: '@html "<span>Anonymous said: \(.)</span>"'
1689
- # input: '"<script>alert(\"lol hax\");</script>"'
1690
- # output: ["<span>Anonymous said: &lt;script&gt;alert(&quot;lol hax&quot;);&lt;/script&gt;</span>"]
1691
-
1692
1720
  - program: '@sh "echo \(.)"'
1693
1721
  input: "\"O'Hara's Ale\""
1694
1722
  output: ["\"echo 'O'\\\\''Hara'\\\\''s Ale'\""]
@@ -1735,7 +1763,7 @@ sections:
1735
1763
 
1736
1764
  The `strptime(fmt)` builtin parses input strings matching the
1737
1765
  `fmt` argument. The output is in the "broken down time"
1738
- representation consumed by `gmtime` and output by `mktime`.
1766
+ representation consumed by `mktime` and output by `gmtime`.
1739
1767
 
1740
1768
  The `strftime(fmt)` builtin formats a time with the given
1741
1769
  format.
@@ -1768,8 +1796,8 @@ sections:
1768
1796
  The expression 'a == b' will produce 'true' if the result of a and b
1769
1797
  are equal (that is, if they represent equivalent JSON documents) and
1770
1798
  'false' otherwise. In particular, strings are never considered equal
1771
- to numbers. If you're coming from Javascript, jq's == is like
1772
- Javascript's === - considering values equal only when they have the
1799
+ to numbers. If you're coming from JavaScript, jq's == is like
1800
+ JavaScript's === - considering values equal only when they have the
1773
1801
  same type as well as the same value.
1774
1802
 
1775
1803
  != is "not equal", and 'a != b' returns the opposite value of 'a == b'
@@ -1779,7 +1807,7 @@ sections:
1779
1807
  input: '[1, 1.0, "1", "banana"]'
1780
1808
  output: ['true', 'true', 'false', 'false']
1781
1809
 
1782
- - title: if-then-else
1810
+ - title: if-then-else-end
1783
1811
  body: |
1784
1812
 
1785
1813
  `if A then B else C end` will act the same as `B` if `A`
@@ -1787,7 +1815,7 @@ sections:
1787
1815
  as `C` otherwise.
1788
1816
 
1789
1817
  Checking for false or null is a simpler notion of
1790
- "truthiness" than is found in Javascript or Python, but it
1818
+ "truthiness" than is found in JavaScript or Python, but it
1791
1819
  means that you'll sometimes have to be more explicit about
1792
1820
  the condition you want: you can't test whether, e.g. a
1793
1821
  string is empty using `if .name then A else B end`, you'll
@@ -1809,10 +1837,10 @@ sections:
1809
1837
  else
1810
1838
  "many"
1811
1839
  end
1812
- input: 2
1840
+ input: '2'
1813
1841
  output: ['"many"']
1814
1842
 
1815
- - title: "`>, >=, <=, <`"
1843
+ - title: "`>`, `>=`, `<=`, `<`"
1816
1844
  body: |
1817
1845
 
1818
1846
  The comparison operators `>`, `>=`, `<=`, `<` return whether
@@ -1824,15 +1852,16 @@ sections:
1824
1852
 
1825
1853
  examples:
1826
1854
  - program: '. < 5'
1827
- input: 2
1855
+ input: '2'
1828
1856
  output: ['true']
1829
1857
 
1830
- - title: and/or/not
1858
+ - title: "`and`, `or`, `not`"
1831
1859
  body: |
1832
1860
 
1833
- jq supports the normal Boolean operators and/or/not. They have the
1834
- same standard of truth as if expressions - false and null are
1835
- considered "false values", and anything else is a "true value".
1861
+ jq supports the normal Boolean operators `and`, `or`, `not`.
1862
+ They have the same standard of truth as if expressions -
1863
+ `false` and `null` are considered "false values", and
1864
+ anything else is a "true value".
1836
1865
 
1837
1866
  If an operand of one of these operators produces multiple
1838
1867
  results, the operator itself will produce a result for each input.
@@ -1842,12 +1871,12 @@ sections:
1842
1871
  rather than with special syntax, as in `.foo and .bar |
1843
1872
  not`.
1844
1873
 
1845
- These three only produce the values "true" and "false", and
1874
+ These three only produce the values `true` and `false`, and
1846
1875
  so are only useful for genuine Boolean operations, rather
1847
1876
  than the common Perl/Python/Ruby idiom of
1848
1877
  "value_that_may_be_null or default". If you want to use this
1849
1878
  form of "or", picking between two values rather than
1850
- evaluating a condition, see the "//" operator below.
1879
+ evaluating a condition, see the `//` operator below.
1851
1880
 
1852
1881
  examples:
1853
1882
  - program: '42 and "a string"'
@@ -1856,9 +1885,6 @@ sections:
1856
1885
  - program: '(true, false) or false'
1857
1886
  input: 'null'
1858
1887
  output: ['true', 'false']
1859
- # - program: '(true, false) and (true, false)'
1860
- # input: 'null'
1861
- # output: ['true', 'false', 'false', 'false']
1862
1888
  - program: '(true, true) and (true, false)'
1863
1889
  input: 'null'
1864
1890
  output: ['true', 'false', 'true', 'false']
@@ -1866,7 +1892,7 @@ sections:
1866
1892
  input: 'null'
1867
1893
  output: ['[false, true]']
1868
1894
 
1869
- - title: Alternative operator - `//`
1895
+ - title: "Alternative operator: `//`"
1870
1896
  body: |
1871
1897
 
1872
1898
  A filter of the form `a // b` produces the same
@@ -1882,10 +1908,10 @@ sections:
1882
1908
  examples:
1883
1909
  - program: '.foo // 42'
1884
1910
  input: '{"foo": 19}'
1885
- output: [19]
1911
+ output: ['19']
1886
1912
  - program: '.foo // 42'
1887
1913
  input: '{}'
1888
- output: [42]
1914
+ output: ['42']
1889
1915
 
1890
1916
  - title: try-catch
1891
1917
  body: |
@@ -1920,14 +1946,14 @@ sections:
1920
1946
  # Repeat an expression until it raises "break" as an
1921
1947
  # error, then stop repeating without re-raising the error.
1922
1948
  # But if the error caught is not "break" then re-raise it.
1923
- try repeat(exp) catch .=="break" then empty else error;
1949
+ try repeat(exp) catch if .=="break" then empty else error
1924
1950
 
1925
1951
  jq has a syntax for named lexical labels to "break" or "go (back) to":
1926
1952
 
1927
1953
  label $out | ... break $out ...
1928
1954
 
1929
1955
  The `break $label_name` expression will cause the program to
1930
- to act as though the nearest (to the left) `label $label_name`
1956
+ act as though the nearest (to the left) `label $label_name`
1931
1957
  produced `empty`.
1932
1958
 
1933
1959
  The relationship between the `break` and corresponding `label`
@@ -1954,46 +1980,47 @@ sections:
1954
1980
  output: ['[null, 1]']
1955
1981
 
1956
1982
 
1957
- - title: Regular expressions (PCRE)
1983
+ - title: Regular expressions
1958
1984
  body: |
1959
1985
 
1960
- jq uses the Oniguruma regular expression library, as do php,
1961
- ruby, TextMate, Sublime Text, etc, so the description here
1986
+ jq uses the Oniguruma regular expression library, as do PHP,
1987
+ Ruby, TextMate, Sublime Text, etc, so the description here
1962
1988
  will focus on jq specifics.
1963
1989
 
1964
1990
  The jq regex filters are defined so that they can be used using
1965
1991
  one of these patterns:
1966
1992
 
1967
- STRING | FILTER( REGEX )
1968
- STRING | FILTER( REGEX; FLAGS )
1969
- STRING | FILTER( [REGEX] )
1970
- STRING | FILTER( [REGEX, FLAGS] )
1993
+ STRING | FILTER(REGEX)
1994
+ STRING | FILTER(REGEX; FLAGS)
1995
+ STRING | FILTER([REGEX])
1996
+ STRING | FILTER([REGEX, FLAGS])
1971
1997
 
1972
1998
  where:
1973
- * STRING, REGEX and FLAGS are jq strings and subject to jq string interpolation;
1974
- * REGEX, after string interpolation, should be a valid PCRE regex;
1999
+
2000
+ * STRING, REGEX, and FLAGS are jq strings and subject to jq string interpolation;
2001
+ * REGEX, after string interpolation, should be a valid regular expression;
1975
2002
  * FILTER is one of `test`, `match`, or `capture`, as described below.
1976
2003
 
1977
2004
  FLAGS is a string consisting of one of more of the supported flags:
1978
2005
 
1979
2006
  * `g` - Global search (find all matches, not just the first)
1980
2007
  * `i` - Case insensitive search
1981
- * `m` - Multi line mode ('.' will match newlines)
2008
+ * `m` - Multi line mode (`.` will match newlines)
1982
2009
  * `n` - Ignore empty matches
1983
2010
  * `p` - Both s and m modes are enabled
1984
- * `s` - Single line mode ('^' -> '\A', '$' -> '\Z')
2011
+ * `s` - Single line mode (`^` -> `\A`, `$` -> `\Z`)
1985
2012
  * `l` - Find longest possible matches
1986
2013
  * `x` - Extended regex format (ignore whitespace and comments)
1987
2014
 
1988
- To match whitespace in an x pattern use an escape such as \s, e.g.
2015
+ To match a whitespace with the `x` flag, use `\s`, e.g.
1989
2016
 
1990
- * test( "a\\sb", "x" ).
2017
+ jq -n '"a b" | test("a\\sb"; "x")'
1991
2018
 
1992
2019
  Note that certain flags may also be specified within REGEX, e.g.
1993
2020
 
1994
- * jq -n '("test", "TEst", "teST", "TEST") | test( "(?i)te(?-i)st" )'
2021
+ jq -n '("test", "TEst", "teST", "TEST") | test("(?i)te(?-i)st")'
1995
2022
 
1996
- evaluates to: true, true, false, false.
2023
+ evaluates to: `true`, `true`, `false`, `false`.
1997
2024
 
1998
2025
  entries:
1999
2026
  - title: "`test(val)`, `test(regex; flags)`"
@@ -2052,7 +2079,7 @@ sections:
2052
2079
 
2053
2080
  - program: '[ match("."; "g")] | length'
2054
2081
  input: '"abc"'
2055
- output: [3]
2082
+ output: ['3']
2056
2083
 
2057
2084
 
2058
2085
  - title: "`capture(val)`, `capture(regex; flags)`"
@@ -2076,24 +2103,20 @@ sections:
2076
2103
  To capture all the matches for each input string, use the idiom
2077
2104
  `[ expr ]`, e.g. `[ scan(regex) ]`.
2078
2105
 
2079
- example:
2106
+ examples:
2080
2107
  - program: 'scan("c")'
2081
2108
  input: '"abcdefabc"'
2082
2109
  output: ['"c"', '"c"']
2083
2110
 
2084
- - program: 'scan("b")'
2085
- input: ("", "")
2086
- output: ['[]', '[]']
2087
-
2088
2111
  - title: "`split(regex; flags)`"
2089
2112
  body: |
2090
2113
 
2091
2114
  For backwards compatibility, `split` splits on a string, not a regex.
2092
2115
 
2093
- example:
2116
+ examples:
2094
2117
  - program: 'split(", *"; null)'
2095
2118
  input: '"ab,cd, ef"'
2096
- output: ['"ab","cd","ef"']
2119
+ output: ['["ab","cd","ef"]']
2097
2120
 
2098
2121
 
2099
2122
  - title: "`splits(regex)`, `splits(regex; flags)`"
@@ -2102,10 +2125,10 @@ sections:
2102
2125
  These provide the same results as their `split` counterparts,
2103
2126
  but as a stream instead of an array.
2104
2127
 
2105
- example:
2128
+ examples:
2106
2129
  - program: 'splits(", *")'
2107
- input: '("ab,cd", "ef, gh")'
2108
- output: ['"ab"', '"cd"', '"ef"', '"gh"']
2130
+ input: '"ab,cd, ef, gh"'
2131
+ output: ['"ab"','"cd"','"ef"','"gh"']
2109
2132
 
2110
2133
  - title: "`sub(regex; tostring)` `sub(regex; string; flags)`"
2111
2134
  body: |
@@ -2115,12 +2138,12 @@ sections:
2115
2138
  be a jq string, and may contain references to named captures. The
2116
2139
  named captures are, in effect, presented as a JSON object (as
2117
2140
  constructed by `capture`) to `tostring`, so a reference to a captured
2118
- variable named "x" would take the form: "\(.x)".
2141
+ variable named "x" would take the form: `"\(.x)"`.
2119
2142
 
2120
- example:
2121
- - program: 'sub("^[^a-z]*(?<x>[a-z]*).*")'
2122
- input: '"123abc456"'
2123
- output: '"ZabcZabc"'
2143
+ examples:
2144
+ - program: 'sub("[^a-z]*(?<x>[a-z]+)"; "Z\(.x)"; "g")'
2145
+ input: '"123abc456def"'
2146
+ output: ['"ZabcZdef"']
2124
2147
 
2125
2148
 
2126
2149
  - title: "`gsub(regex; string)`, `gsub(regex; string; flags)`"
@@ -2129,10 +2152,10 @@ sections:
2129
2152
  `gsub` is like `sub` but all the non-overlapping occurrences of the regex are
2130
2153
  replaced by the string, after interpolation.
2131
2154
 
2132
- example:
2155
+ examples:
2133
2156
  - program: 'gsub("(?<x>.)[^a]*"; "+\(.x)-")'
2134
2157
  input: '"Abcabc"'
2135
- output: '"+A-+a-"'
2158
+ output: ['"+A-+a-"']
2136
2159
 
2137
2160
 
2138
2161
  - title: Advanced features
@@ -2149,7 +2172,7 @@ sections:
2149
2172
 
2150
2173
  It is also possible to define functions in jq, although this is
2151
2174
  is a feature whose biggest use is defining jq's standard library
2152
- (many jq functions such as `map` and `find` are in fact written
2175
+ (many jq functions such as `map` and `select` are in fact written
2153
2176
  in jq).
2154
2177
 
2155
2178
  jq has reduction operators, which are very powerful but a bit
@@ -2199,7 +2222,7 @@ sections:
2199
2222
  fields, and another object which is used to map author usernames to
2200
2223
  real names. Our input looks like:
2201
2224
 
2202
- {"posts": [{"title": "Frist psot", "author": "anon"},
2225
+ {"posts": [{"title": "First post", "author": "anon"},
2203
2226
  {"title": "A well-written article", "author": "person1"}],
2204
2227
  "realnames": {"anon": "Anonymous Coward",
2205
2228
  "person1": "Person McPherson"}}
@@ -2207,7 +2230,7 @@ sections:
2207
2230
  We want to produce the posts with the author field containing a real
2208
2231
  name, as in:
2209
2232
 
2210
- {"title": "Frist psot", "author": "Anonymous Coward"}
2233
+ {"title": "First post", "author": "Anonymous Coward"}
2211
2234
  {"title": "A well-written article", "author": "Person McPherson"}
2212
2235
 
2213
2236
  We use a variable, $names, to store the realnames object, so that we
@@ -2221,7 +2244,7 @@ sections:
2221
2244
  foreach loop.
2222
2245
 
2223
2246
  Just as `{foo}` is a handy way of writing `{foo: .foo}`, so
2224
- `{$foo}` is a handy way of writing `{foo:$foo}`.
2247
+ `{$foo}` is a handy way of writing `{foo: $foo}`.
2225
2248
 
2226
2249
  Multiple variables may be declared using a single `as` expression by
2227
2250
  providing a pattern that matches the structure of the input
@@ -2320,29 +2343,6 @@ sections:
2320
2343
  input: '[[1,2],[10,20]]'
2321
2344
  output: ['[[1,2,1,2], [10,20,1,2]]']
2322
2345
 
2323
- - title: Reduce
2324
- body: |
2325
-
2326
- The `reduce` syntax in jq allows you to combine all of the
2327
- results of an expression by accumulating them into a single
2328
- answer. As an example, we'll pass `[3,2,1]` to this expression:
2329
-
2330
- reduce .[] as $item (0; . + $item)
2331
-
2332
- For each result that `.[]` produces, `. + $item` is run to
2333
- accumulate a running total, starting from 0. In this
2334
- example, `.[]` produces the results 3, 2, and 1, so the
2335
- effect is similar to running something like this:
2336
-
2337
- 0 | (3 as $item | . + $item) |
2338
- (2 as $item | . + $item) |
2339
- (1 as $item | . + $item)
2340
-
2341
- examples:
2342
- - program: 'reduce .[] as $item (0; . + $item)'
2343
- input: '[10,2,5,3]'
2344
- output: ['20']
2345
-
2346
2346
  - title: "`limit(n; exp)`"
2347
2347
  body: |
2348
2348
 
@@ -2382,32 +2382,79 @@ sections:
2382
2382
  input: '10'
2383
2383
  output: ['[0,9,5]']
2384
2384
 
2385
+ - title: "`reduce`"
2386
+ body: |
2387
+
2388
+ The `reduce` syntax allows you to combine all of the results of
2389
+ an expression by accumulating them into a single answer.
2390
+ The form is `reduce EXP as $var (INIT; UPDATE)`.
2391
+ As an example, we'll pass `[1,2,3]` to this expression:
2392
+
2393
+ reduce .[] as $item (0; . + $item)
2394
+
2395
+ For each result that `.[]` produces, `. + $item` is run to
2396
+ accumulate a running total, starting from 0 as the input value.
2397
+ In this example, `.[]` produces the results `1`, `2`, and `3`,
2398
+ so the effect is similar to running something like this:
2399
+
2400
+ 0 | 1 as $item | . + $item |
2401
+ 2 as $item | . + $item |
2402
+ 3 as $item | . + $item
2403
+
2404
+ examples:
2405
+ - program: 'reduce .[] as $item (0; . + $item)'
2406
+ input: '[1,2,3,4,5]'
2407
+ output: ['15']
2408
+
2409
+ - program: 'reduce .[] as [$i,$j] (0; . + $i * $j)'
2410
+ input: '[[1,2],[3,4],[5,6]]'
2411
+ output: ['44']
2412
+
2413
+ - program: 'reduce .[] as {$x,$y} (null; .x += $x | .y += [$y])'
2414
+ input: '[{"x":"a","y":1},{"x":"b","y":2},{"x":"c","y":3}]'
2415
+ output: ['{"x":"abc","y":[1,2,3]}']
2416
+
2385
2417
  - title: "`foreach`"
2386
2418
  body: |
2387
2419
 
2388
2420
  The `foreach` syntax is similar to `reduce`, but intended to
2389
2421
  allow the construction of `limit` and reducers that produce
2390
- intermediate results (see example).
2422
+ intermediate results.
2391
2423
 
2392
2424
  The form is `foreach EXP as $var (INIT; UPDATE; EXTRACT)`.
2393
- Like `reduce`, `INIT` is evaluated once to produce a state
2394
- value, then each output of `EXP` is bound to `$var`, `UPDATE`
2395
- is evaluated for each output of `EXP` with the current state
2396
- and with `$var` visible. Each value output by `UPDATE`
2397
- replaces the previous state. Finally, `EXTRACT` is evaluated
2398
- for each new state to extract an output of `foreach`.
2425
+ As an example, we'll pass `[1,2,3]` to this expression:
2426
+
2427
+ foreach .[] as $item (0; . + $item; [$item, . * 2])
2428
+
2429
+ Like the `reduce` syntax, `. + $item` is run for each result
2430
+ that `.[]` produces, but `[$item, . * 2]` is run for each
2431
+ intermediate values. In this example, since the intermediate
2432
+ values are `1`, `3`, and `6`, the `foreach` expression produces
2433
+ `[1,2]`, `[2,6]`, and `[3,12]`. So the effect is similar
2434
+ to running something like this:
2399
2435
 
2400
- This is mostly useful only for constructing `reduce`- and
2401
- `limit`-like functions. But it is much more general, as it
2402
- allows for partial reductions (see the example below).
2436
+ 0 | 1 as $item | . + $item | [$item, . * 2],
2437
+ 2 as $item | . + $item | [$item, . * 2],
2438
+ 3 as $item | . + $item | [$item, . * 2]
2439
+
2440
+ When `EXTRACT` is omitted, the identity filter is used.
2441
+ That is, it outputs the intermediate values as they are.
2403
2442
 
2404
2443
  examples:
2405
- - program: '[foreach .[] as $item
2406
- ([[],[]];
2407
- if $item == null then [[],.[0]] else [(.[0] + [$item]),[]] end;
2408
- if $item == null then .[1] else empty end)]'
2409
- input: '[1,2,3,4,null,"a","b",null]'
2410
- output: ['[[1,2,3,4],["a","b"]]']
2444
+ - program: 'foreach .[] as $item (0; . + $item)'
2445
+ input: '[1,2,3,4,5]'
2446
+ output: ['1','3','6','10','15']
2447
+
2448
+ - program: 'foreach .[] as $item (0; . + $item; [$item, . * 2])'
2449
+ input: '[1,2,3,4,5]'
2450
+ output: ['[1,2]','[2,6]','[3,12]','[4,20]','[5,30]']
2451
+
2452
+ - program: 'foreach .[] as $item (0; . + 1; {index: ., $item})'
2453
+ input: '["foo", "bar", "baz"]'
2454
+ output:
2455
+ - '{"index":1,"item":"foo"}'
2456
+ - '{"index":2,"item":"bar"}'
2457
+ - '{"index":3,"item":"baz"}'
2411
2458
 
2412
2459
  - title: Recursion
2413
2460
  body: |
@@ -2523,6 +2570,8 @@ sections:
2523
2570
 
2524
2571
  Outputs one new input.
2525
2572
 
2573
+ echo 1 2 3 4 | jq '[., input]' # [1,2] [3,4]
2574
+
2526
2575
  - title: "`inputs`"
2527
2576
  body: |
2528
2577
 
@@ -2531,6 +2580,8 @@ sections:
2531
2580
  This is primarily useful for reductions over a program's
2532
2581
  inputs.
2533
2582
 
2583
+ echo 1 2 3 | jq -n 'reduce inputs as $i (0; . + $i)' # 6
2584
+
2534
2585
  - title: "`debug`"
2535
2586
  body: |
2536
2587
 
@@ -2571,8 +2622,8 @@ sections:
2571
2622
  Streaming forms include `[<path>, <leaf-value>]` (to indicate any
2572
2623
  scalar value, empty array, or empty object), and `[<path>]` (to
2573
2624
  indicate the end of an array or object). Future versions of jq
2574
- run with `--stream` and `-seq` may output additional forms such as
2575
- `["error message"]` when an input text fails to parse.
2625
+ run with `--stream` and `--seq` may output additional forms such
2626
+ as `["error message"]` when an input text fails to parse.
2576
2627
 
2577
2628
  entries:
2578
2629
  - title: "`truncate_stream(stream_expression)`"
@@ -2583,9 +2634,9 @@ sections:
2583
2634
  given streaming expression.
2584
2635
 
2585
2636
  examples:
2586
- - program: '[1|truncate_stream([[0],1],[[1,0],2],[[1,0]],[[1]])]'
2637
+ - program: 'truncate_stream([[0],1],[[1,0],2],[[1,0]],[[1]])'
2587
2638
  input: '1'
2588
- output: ['[[[0],2],[[0]]]']
2639
+ output: ['[[0],2]', '[[0]]']
2589
2640
 
2590
2641
  - title: "`fromstream(stream_expression)`"
2591
2642
  body: |
@@ -2620,7 +2671,7 @@ sections:
2620
2671
  If an object has two fields which are arrays, `.foo` and `.bar`,
2621
2672
  and you append something to `.foo`, then `.bar` will not get
2622
2673
  bigger. Even if you've just set `.bar = .foo`. If you're used to
2623
- programming in languages like Python, Java, Ruby, Javascript,
2674
+ programming in languages like Python, Java, Ruby, JavaScript,
2624
2675
  etc. then you can think of it as though jq does a full deep copy
2625
2676
  of every object before it does the assignment (for performance,
2626
2677
  it doesn't actually do that, but that's the general idea).
@@ -2640,7 +2691,7 @@ sections:
2640
2691
  .foo = .bar | .foo.baz = 1
2641
2692
 
2642
2693
  will not have the side-effect of setting .bar.baz to be set
2643
- to 1, as the similar-looking program in Javascript, Python,
2694
+ to 1, as the similar-looking program in JavaScript, Python,
2644
2695
  Ruby or other languages would. Unlike these languages (but
2645
2696
  like Haskell and some other functional languages), there is
2646
2697
  no notion of two arrays or objects being "the same array" or
@@ -2765,13 +2816,13 @@ sections:
2765
2816
  path (see below). The `import` and `include` directives allow the
2766
2817
  importer to alter this path.
2767
2818
 
2768
- Paths in the a search path are subject to various substitutions.
2819
+ Paths in the search path are subject to various substitutions.
2769
2820
 
2770
2821
  For paths starting with "~/", the user's home directory is
2771
2822
  substituted for "~".
2772
2823
 
2773
- For paths starting with "$ORIGIN/", the path of the jq executable
2774
- is substituted for "$ORIGIN".
2824
+ For paths starting with "$ORIGIN/", the directory where the jq
2825
+ executable is located is substituted for "$ORIGIN".
2775
2826
 
2776
2827
  For paths starting with "./" or paths that are ".", the path of
2777
2828
  the including file is substituted for ".". For top-level programs