typeof
Function
typeof — the type of a value
Synopsis
typeof(val: any) -> type
Description
The typeof function returns the type of
its argument val
. Types in Zed are first class so the returned type is
also a Zed value. The type of a type is type type
.
Examples
The types of various values:
echo '1 "foo" 10.0.0.1 [1,2,3] {s:"foo"} null error("missing")' |
zq -z 'yield typeof(this)' -
=>
<int64>
<string>
<ip>
<[int64]>
<{s:string}>
<null>
<error(string)>
The type of a type is type type
:
echo null | zq -z 'yield typeof(typeof(this))' -
=>
<type>