nameof
Function
nameof — the name of a named type
Synopsis
nameof(val: any) -> string
Description
The nameof function returns the type name of val
as a string if val
is a named type.
Otherwise, it returns error("missing")
.
Examples
A named type returns its name and unnamed types return a missing error:
values nameof(this)
80::port=int16
80
Loading...
echo '80::port=int16
80' \
| super -s -c 'values nameof(this)' -
The missing value can be ignored with quiet:
values quiet(nameof(this))
80::port=int16
80
Loading...
echo '80::port=int16
80' \
| super -s -c 'values quiet(nameof(this))' -