under

Table of Contents

Function

under — the underlying value

Synopsis

under(val: any) -> any

Description

The under function returns the value underlying the argument val:

  • for unions, it returns the value as its elemental type of the union,
  • for errors, it returns the value that the error wraps,
  • for types, it returns the value typed as typeunder() indicates; otherwise,
  • it returns val unmodified.

Examples

Unions are unwrapped:

yield this
1((int64,string))
"foo"((int64,string))
Loading...

Errors are unwrapped:

yield this
error("foo")
error({err:"message"})
Loading...

Values of named types are unwrapped:

yield this
80(port=uint16)
Loading...

Values that are not wrapped are unmodified:

yield under(this)
1
"foo"
<int16>
{x:1}
Loading...
Next: unflatten

SuperDB