pub(crate) fn with_array_items<R>(
t: &Value,
f: impl FnOnce(&[Value]) -> R,
) -> Option<R>Expand description
this が実配列(ObjKind::Array)かどうか。join/slice/concat に続き、
forEach/map/filter/indexOf/includes 等の仕様上ジェネリックなメソッドで
this_items(非配列は無条件で空 Vec)から array_like_items
(length+添字プロパティを読む汎用フォールバック)への切り替え判定に使う共通ヘルパ。
本物の配列(ObjKind::Array、Proxy は外す)の要素を写さずに見る。JS を呼ばない処理(比較・添字)だけに使う。
【2026-11-04】at・indexOf・includes・lastIndexOf が呼ぶたびに配列全体を写していた(a.at(i) の繰り返しが O(n²))。