• Attaches a 'fake' length to an object (likely iterable or iterator) which does not have a length property, so that it can work well with functions that use getLength.

    Parameters

    • iter: any
    • length: number

    Returns any

    Example

    const myRange = range(12);
    setLength(myRange, 12);
    getLength(myRange); // returns 12.