any
for filters> any {flags} (predicate)
predicate
: a closure that must evaluate to a booleaninput | output |
---|---|
list<any> | bool |
table | bool |
Check if any row's status is the string 'DOWN'
> [[status]; [UP] [DOWN] [UP]] |any {|el| $el.status==DOWN }
true
Check that any item is a string
> [1234] |any {|| ($in|describe) =='string' }
false
Check if any value is equal to twice its own index
> [9876] |enumerate|any {|i| $i.item==$i.index*2 }
true
Check if any of the values are odd, using a stored closure
>letcond= {|e| $emod2==1 }; [24168] |any$cond
true
Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/any.html