Skip to main content

array_from_async

Function array_from_async 

Source
pub(crate) fn array_from_async(
    it: &mut Interp,
    t: Value,
    a: &[Value],
) -> Result<Value, Value>
Expand description

Array.fromAsync(iterableOrLike, mapFn?, thisArg?)(ES2024/2025 相当)。 本来は非同期イテレータプロトコル(Symbol.asyncIterator)にも対応するが、この処理系には まだ for-await-of / 非同期イテレータが無いため、同期イテラブル(配列・Set・Map・ generator・文字列・array-like)を対象に、各要素が Promise ならその場で await する 簡略実装。戻り値は仕様どおり Promise でラップする。