Skip to main content

index_len

Function index_len 

Source
pub fn index_len(v: &Value) -> Option<usize>
Expand description

The number of elements v exposes as integer-index own properties, for a typed array (@@elems) or a Buffer (@@bytes); None for anything else.

Both index-membership questions — obj.hasOwnProperty(i) and i in obj — must answer from this one place. They used to disagree: hasOwnProperty carried a hand-rolled arm that understood @@bytes only, so it was right for a Buffer and wrong for every other typed array, while the in operator knew about neither and reported false for every valid index of both.