SheetXL - v1.0.2
    Preparing search index...

    Interface IRichDataCollection

    The rich values a workbook's cells hold, interned: a cell run stores a rich value as its id here, as it stores a string as its id in the string collection.

    Equal values share one id (equal JSON; a resource counts by identity), so recalculating a formula that makes a new but equal value adds nothing. Values are not removed: a save writes only the ones a cell holds.

    interface IRichDataCollection {
        isICollection: true;
        isIRichDataCollection: true;
        length: number;
        "[iterator]"(): IterableIterator<IRichData>;
        add(value: IRichData): number;
        addListeners(
            listeners: ICollection.IListeners,
            options?: IListener.Options,
        ): Remove;
        at(index: number): IRichData | undefined;
        beginPersist(): IRichDataCollection.IPersistScope;
        every(
            predicate: (
                value: IRichData,
                index: number,
                items: readonly IRichData[],
            ) => boolean,
        ): boolean;
        filter<S extends IRichData>(
            predicate: (
                value: IRichData,
                index: number,
                items: readonly IRichData[],
            ) => value is S,
        ): S[];
        filter(
            predicate: (
                value: IRichData,
                index: number,
                items: readonly IRichData[],
            ) => boolean,
        ): IRichData[];
        find<S extends IRichData>(
            predicate: (
                value: IRichData,
                index: number,
                items: readonly IRichData[],
            ) => value is S,
        ): S | undefined;
        find(
            predicate: (
                value: IRichData,
                index: number,
                items: readonly IRichData[],
            ) => boolean,
        ): IRichData | undefined;
        findIndex(
            predicate: (
                value: IRichData,
                index: number,
                items: readonly IRichData[],
            ) => boolean,
        ): number;
        forEach(
            fn: (
                value: IRichData,
                index: number,
                items: readonly IRichData[],
            ) => void,
        ): void;
        getById(id: number): IRichData | null;
        getCount(): number;
        getItems(options?: ICollection.GetItemsOptions): IRichData[];
        indexOf(item: IRichData): number;
        isClosed(): boolean;
        map<U>(
            fn: (value: IRichData, index: number, items: readonly IRichData[]) => U,
        ): U[];
        some(
            predicate: (
                value: IRichData,
                index: number,
                items: readonly IRichData[],
            ) => boolean,
        ): boolean;
        toArray(): IRichData[];
        readonly [index: number]: IRichData;
    }

    Hierarchy (View Summary)

    Implemented by

    Indexable

    • readonly [index: number]: IRichData

      The item at the given index, or undefined if there is none — wb.getWorksheets()[0].

      Read-only and live: each read is against the collection as it is now. Assigning through an index throws.

    Index
    isICollection: true

    For runtime type checking.

    isIRichDataCollection: true

    For runtime type checking.

    length: number

    The number of items — the same as getCount.

    • Iterates the collection's items.

      Returns IterableIterator<IRichData>

      The unfiltered walk — for (const sheet of wb.getWorksheets()). Every other iterable surface in the SDK (ICellRange, ICellRegions, ICellRanges) reads this way, so a collection that did not was a trap: for…of over one is the obvious line to write and it threw at runtime with nothing in the types to warn first.

      getItems remains the call that takes options — filtering, ordering, anything parameterized. This is sugar over the unfiltered case, not a replacement for it.

    • The id of value, added when no equal value is here.

      Parameters

      • value: IRichData

        A rich value. Never an error: an error is stored by its code.

      Returns number

    • Returns the item at the given index, or undefined if there is none.

      Parameters

      • index: number

        The position in iteration order. A negative index counts back from the end, as Array.prototype.at does.

      Returns IRichData | undefined

    • Returns true if the predicate accepts every item, including when there are none.

      Parameters

      • predicate: (value: IRichData, index: number, items: readonly IRichData[]) => boolean

        Called once per item in iteration order until it returns false.

      Returns boolean

    • Returns the items the predicate accepts, in iteration order.

      Type Parameters

      • S extends IRichData

      Parameters

      • predicate: (value: IRichData, index: number, items: readonly IRichData[]) => value is S

        Called once per item.

      Returns S[]

    • Returns the items the predicate accepts, in iteration order.

      Parameters

      • predicate: (value: IRichData, index: number, items: readonly IRichData[]) => boolean

        Called once per item.

      Returns IRichData[]

    • Returns the first item the predicate accepts, or undefined if it accepts none.

      Type Parameters

      • S extends IRichData

      Parameters

      • predicate: (value: IRichData, index: number, items: readonly IRichData[]) => value is S

        Called once per item in iteration order until it returns true.

      Returns S | undefined

    • Returns the first item the predicate accepts, or undefined if it accepts none.

      Parameters

      • predicate: (value: IRichData, index: number, items: readonly IRichData[]) => boolean

        Called once per item in iteration order until it returns true.

      Returns IRichData | undefined

    • Returns the index of the first item the predicate accepts, or -1 if it accepts none.

      Parameters

      • predicate: (value: IRichData, index: number, items: readonly IRichData[]) => boolean

        Called once per item in iteration order until it returns true.

      Returns number

    • Calls the function once per item, in iteration order.

      Parameters

      • fn: (value: IRichData, index: number, items: readonly IRichData[]) => void

        Called once per item.

      Returns void

    • The value for an id, or null if not found.

      Parameters

      • id: number

        The id add answered.

      Returns IRichData | null

    • Returns the total items available.

      Returns number

      returns the total number of items available.

    • Returns the items in the collection.

      Parameters

      Returns IRichData[]

      The optioned call — filtering, ordering, anything parameterized — and a snapshot: the array returned does not follow later changes to the collection. For the unfiltered items as a plain array prefer toArray.

    • Returns the index of the item in iteration order, or -1 if it is not in the collection.

      Parameters

      • item: IRichData

        The item to find.

      Returns number

    • Returns true once the collection has been closed.

      Returns boolean

      A closed collection is empty and announces nothing further. Collections that are closed by their owner (the workbook's names, functions and modules, when the workbook closes) announce it once with ICollection.Events.onClose; the others are never closed and always return false.

    • Returns the result of calling the function on every item, in iteration order.

      Type Parameters

      • U

      Parameters

      • fn: (value: IRichData, index: number, items: readonly IRichData[]) => U

        Called once per item.

      Returns U[]

    • Returns true if the predicate accepts at least one item.

      Parameters

      • predicate: (value: IRichData, index: number, items: readonly IRichData[]) => boolean

        Called once per item in iteration order until it returns true.

      Returns boolean

    • Returns the items as a fresh array, in iteration order.

      Returns IRichData[]

      The call to make when an array is really wanted. The array is the caller's: changing it does not change the collection, and it does not follow later changes to the collection.