September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -0,0 +1,19 @@
def Array(atype; n):
if atype == "number" then [ range(0;n) ]
elif atype == "object" then [ range(0;n)| {"value": . } ]
elif atype == "array" then [ range(0;n)| [.] ]
elif atype == "string" then [ range(0;n)| tostring ]
elif atype == "boolean" then
if n == 0 then [] elif n == 1 then [false] elif n==2 then [false, true]
else error("there are only two boolean values")
end
elif atype == "null" then
if n == 0 then [] elif n == 1 then [null]
else error("there is only one null value")
end
else error("\(atype) is not a jq type")
end;
# Example:
Array("object"; 4)