Handle chained _ (#27)

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
Anand Krishnamoorthi
2023-10-17 19:32:42 -07:00
committed by GitHub
parent 2436467fbd
commit 951bb6b14c
4 changed files with 193 additions and 13 deletions

View File

@@ -344,6 +344,10 @@ impl ops::Index<&Value> for Value {
Some(v) => v,
_ => &Value::Undefined,
},
(Value::Set(s), _) => match s.get(key) {
Some(v) => v,
_ => &Value::Undefined,
},
(Value::Array(a), Value::Number(n)) => {
let index = n.0 .0 as usize;
if index < a.len() {