nushell/crates/nu-protocol/src/ast
Bahex 089c5221cc
Add new operators has and not-has (#14841)
# Description
This PR add 2 new operators, `has` and `not-has`. They are basically
`in` and `not-in` with the order of operands swapped.

Motivation for this was the awkward way of searching for rows that
contain an item using `where`

```nushell
[[name, children]; [foo, [a, b, c]], [bar [d, e, f]]]
| where ("e" in $it.children)
```
vs
```nushell
[[name, children]; [foo, [a, b, c]], [bar [d, e, f]]]
| where children has "e"
``` 

# User-Facing Changes
Added `has` and `not-has` operators, mirroring `in` and `not-in`.

# Tests + Formatting

- 🟢 toolkit fmt
- 🟢 toolkit clippy
- 🟢 toolkit test
- 🟢 toolkit test stdlib

# After Submitting
2025-01-17 06:20:00 -06:00
..
block.rs Overhaul $in expressions (#13357) 2024-07-17 16:02:42 -05:00
call.rs Replace raw usize IDs with new types (#13832) 2024-09-30 13:20:15 +02:00
cell_path.rs Improve CellPath display output (#14197) 2024-11-02 10:28:10 -05:00
expr.rs Replace raw usize IDs with new types (#13832) 2024-09-30 13:20:15 +02:00
expression.rs Make SpanId and RegId also use new ID struct (#13963) 2024-10-01 13:23:27 +02:00
import_pattern.rs Document public types in nu-protocol (#12906) 2024-07-11 13:30:12 +02:00
keyword.rs Shrink the size of Expr (#12610) 2024-04-24 15:46:35 +00:00
match_pattern.rs Change how and and or operations are compiled to IR to support custom values (#14653) 2024-12-25 06:12:53 -06:00
mod.rs Document public types in nu-protocol (#12906) 2024-07-11 13:30:12 +02:00
operator.rs Add new operators has and not-has (#14841) 2025-01-17 06:20:00 -06:00
pipeline.rs Overhaul $in expressions (#13357) 2024-07-17 16:02:42 -05:00
range.rs Shrink the size of Expr (#12610) 2024-04-24 15:46:35 +00:00
table.rs Shrink the size of Expr (#12610) 2024-04-24 15:46:35 +00:00
unit.rs Add Filesize type (#14369) 2024-11-29 21:24:17 +00:00
value_with_unit.rs Shrink the size of Expr (#12610) 2024-04-24 15:46:35 +00:00