mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 12:35:59 +02:00
Add zip-into-record
to std iter (#9395)
# Description Adds a new iter feature `zip-into-record` (#9380) # User-Facing Changes User can use `[1 2] | iter zip-into-record [3 4]` to create a table `[[1 2]; [3 4]]` # Tests + Formatting I noticed trailing spaces in std library that may wish to be cleaned in the future. Co-authored-by: amtoine <stevan.antoine@gmail.com>
This commit is contained in:
@ -110,3 +110,17 @@ export def test_iter_flat_map [] {
|
||||
let res = ([1 2 3] | iter flat-map {|it| $it + ($it * 10)})
|
||||
assert equal $res [11 22 33]
|
||||
}
|
||||
|
||||
export def test_iter_zip_into_record [] {
|
||||
let headers = [name repo position]
|
||||
let values = [rust github 1]
|
||||
|
||||
let res = (
|
||||
$headers | iter zip-into-record $values
|
||||
)
|
||||
|
||||
assert equal $res [
|
||||
[name repo position];
|
||||
[rust github 1]
|
||||
]
|
||||
}
|
||||
|
Reference in New Issue
Block a user