Adds "toboolean" builtin function for converting strings to booleans (#2098)

This commit is contained in:
Brahm Lower authored and GitHub committed 2025-05-18 16:31:10 +09:00
1 parent 92daac90f6
commit c350566001
5 files changed
+67

No files matched your search

+12
View File
@@ -1477,6 +1477,18 @@ sections:
input: '[1, "1"]'
output: ['1', '1']
- title: "`toboolean`"
body: |
The `toboolean` function parses its input as a boolean. It
will convert correctly-formatted strings to their boolean
equivalent, leave booleans alone, and give an error on all other input.
examples:
- program: '.[] | toboolean'
input: '["true", "false", true, false]'
output: ['true', 'false', 'true', 'false']
- title: "`tostring`"
body: |