Documentation
    Preparing search index...

    Namespace ArrayUtil

    A namespace providing utility functions for array manipulation.

    This namespace contains utility functions for array operations including asynchronous processing, filtering, mapping, and repetition tasks implemented in functional programming style. Functions use direct parameter passing for simplicity while maintaining functional programming principles.

    Processing cost: Sequential array operations visit each required position once; has short-circuits, and subsets materializes the exponential power-set output. Async helpers await one user callback per position and preserve its ordering rather than assuming callbacks are independent.

    Resource ownership: Async helpers await one callback at a time and keep their input and partial output until settlement; results transfer to the caller. Synchronous helpers retain only their local arrays and recursion state. Callback resources and cancellation belong to the caller.

    Jeongho Nam - https://github.com/samchon

    // Asynchronous filtering example
    const numbers = [1, 2, 3, 4, 5];
    const evenNumbers = await ArrayUtil.asyncFilter(
    numbers,
    async (num) => num % 2 === 0,
    );
    console.log(evenNumbers); // [2, 4]

    contracts/common.md#principled-implementation Asynchronous filtering and mapping share sequential asyncForEach; repetition awaits each index and collects its results. Synchronous helpers use loops and native methods, and subsets enumerates the include or exclude choice per position.

    contracts/common.md#clear-and-simple-design Filtering and mapping share iteration without allocating unused results; repetition separately collects its results, with one private count validator.

    contracts/common.md#prohibited-implementation-shortcuts No function special-cases a value, a fixture, or a caller; ordering and short-circuiting follow from the loop and the native some.

    contracts/common.md#meaningful-documentation The namespace prose states the sequential, functional style, and each function documents its parameters, its result, and an example.

    asyncFilter
    asyncForEach
    asyncMap
    asyncRepeat
    has
    repeat
    subsets