items

For filters.

Given a record, iterate on each pair of column name and associated value.

Command Type

built-in

Signature

> items {flags} (closure)

Parameters

  • closure: The closure to run.

Input/output types:

input output
record any

Examples

Iterate over each key-value pair of a record

> { new: york, san: francisco } | items {|key, value| echo $'($key) ($value)' }
╭───┬───────────────╮
│ 0 │ new york      │
│ 1 │ san francisco │
╰───┴───────────────╯

Notes

This is a fusion of columns, values and each.

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.