mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 22:57:46 +00:00

Deprecates the existing `stdlib-candidate` directories in `nu_scripts` since `std-rfc` has now transitioned to the main repo. Updates readme and renamed directories.
17 lines
378 B
Text
17 lines
378 B
Text
# Convert a Nushell value to a list
|
|
#
|
|
# Primary useful for range-to-list, but other types are accepted as well.
|
|
#
|
|
# Example:
|
|
#
|
|
# 1..10 | into list
|
|
export def "into list" []: any -> list {
|
|
let input = $in
|
|
let type = ($input | describe --detailed | get type)
|
|
match $type {
|
|
range => {$input | each {||}}
|
|
list => $input
|
|
table => $input
|
|
_ => [ $input ]
|
|
}
|
|
}
|