Files
dotfiles/dot_config/nushell/nu_scripts/stdlib-candidate/std-rfc/conversions/into.nu
Cian Hughes 896af887ca Changed . token to _dot
This change allows the dotfiles to work with chezmoi (e.g: on windows)
and improves grepability with neovim/telescope
2024-11-07 13:52:17 +00:00

18 lines
379 B
Nu

# 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 ]
}
}