We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 23187ab + 52bfba1 commit 2186777Copy full SHA for 2186777
prelude.jq
@@ -2,6 +2,7 @@ def not: if . then false else true end;
2
def select(f): if f then . else empty end;
3
def map(f): [.[] | f];
4
def map_values(f): .[] |= f;
5
+def abs: if . < 0 then - . else . end;
6
7
def isfinite: isinfinite | not;
8
def nulls: select(type == "null");
tests/from_manual/functions.rs
@@ -1,5 +1,18 @@
1
use crate::test;
+test!(
+ abs1,
+ r#"
+ map(abs)
+ "#,
9
+ [-10, -1.1, -1e-1]
10
11
12
+ [10,1.1,1e-1]
13
+ "#
14
+);
15
+
16
test!(
17
length1,
18
r#"
0 commit comments