fields
Table of Contents
Function
fields — return the flattened path names of a record
Synopsis
fields(r: record) -> [[string]]
Description
The fields function returns an array of string arrays of all the field names in record r
.
A field’s path name is representing by an array of strings since the dot
separator is an unreliable indicator of field boundaries as .
itself
can appear in a field name.
error("missing")
is returned if r
is not a record.
Examples
Extract the fields of a nested record:
yield fields(this)
{a:1,b:2,c:{d:3,e:4}}
Loading...
Easily convert to dotted names if you prefer:
over fields(this) |> yield join(this,".")
{a:1,b:2,c:{d:3,e:4}}
Loading...
A record is expected:
yield {f:fields(this)}
true
Loading...