SheetXL - v0.8.0-beta.9+sites.210.e2d420901
    Preparing search index...

    Interface INamedFormulasCollection

    Collection of named formulas available in the calculation engine.

    Keyed by the formula's id, not ordered: iteration order is unspecified.

    interface INamedFormulasCollection {
        isICollection: true;
        isINamedFormulasCollection: true;
        "[iterator]"(): IterableIterator<INamedFormula>;
        add(options: INamedFormulasCollection.AddOptions): INamedFormula;
        addListeners(
            listeners: INamedFormulasCollection.IListeners,
            options?: IListener.Options,
        ): Remove;
        at(index: number): INamedFormula | undefined;
        every(
            predicate: (
                value: INamedFormula,
                index: number,
                items: readonly INamedFormula[],
            ) => boolean,
        ): boolean;
        filter<S extends INamedFormula>(
            predicate: (
                value: INamedFormula,
                index: number,
                items: readonly INamedFormula[],
            ) => value is S,
        ): S[];
        filter(
            predicate: (
                value: INamedFormula,
                index: number,
                items: readonly INamedFormula[],
            ) => boolean,
        ): INamedFormula[];
        find<S extends INamedFormula>(
            predicate: (
                value: INamedFormula,
                index: number,
                items: readonly INamedFormula[],
            ) => value is S,
        ): S | undefined;
        find(
            predicate: (
                value: INamedFormula,
                index: number,
                items: readonly INamedFormula[],
            ) => boolean,
        ): INamedFormula | undefined;
        findIndex(
            predicate: (
                value: INamedFormula,
                index: number,
                items: readonly INamedFormula[],
            ) => boolean,
        ): number;
        forEach(
            fn: (
                value: INamedFormula,
                index: number,
                items: readonly INamedFormula[],
            ) => void,
        ): void;
        getById(id: string): INamedFormula | null;
        getByName(name: string): INamedFormula | null;
        getCount(): number;
        getItems(
            options?: INamedFormulasCollection.GetItemsOptions,
        ): INamedFormula[];
        indexOf(item: INamedFormula): number;
        isClosed(): boolean;
        map<U>(
            fn: (
                value: INamedFormula,
                index: number,
                items: readonly INamedFormula[],
            ) => U,
        ): U[];
        some(
            predicate: (
                value: INamedFormula,
                index: number,
                items: readonly INamedFormula[],
            ) => boolean,
        ): boolean;
        toArray(): INamedFormula[];
        toJSON(): INamed.JSON[] | null;
    }

    Hierarchy (View Summary)

    Index
    isICollection: true

    For runtime type checking.

    isINamedFormulasCollection: true

    For runtime type checking.

    • Iterates the collection's items.

      Returns IterableIterator<INamedFormula>

      The unfiltered walk — for (const sheet of wb.getSheets()). 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.

    • 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 INamedFormula | undefined

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

      Parameters

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

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

      Returns boolean

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

      Type Parameters

      Parameters

      • predicate: (
            value: INamedFormula,
            index: number,
            items: readonly INamedFormula[],
        ) => 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: INamedFormula,
            index: number,
            items: readonly INamedFormula[],
        ) => boolean

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

      Returns INamedFormula | undefined

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

      Parameters

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

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

      Returns number

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

      Parameters

      Returns void

    • Returns a named formula by its stable internal id, or null if not found. Will be made required in a future release.

      Parameters

      • id: string

      Returns INamedFormula | null

    • Convenience method for filter by name. This is functionally equivalent to getItems({ name }).

      Parameters

      • name: string

        The name to search for. This is case insensitive.

      Returns INamedFormula | null

    • Returns the total items available.

      Returns number

      returns the total number of items available.

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

      Parameters

      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

      Returns U[]

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

      Parameters

      • predicate: (
            value: INamedFormula,
            index: number,
            items: readonly INamedFormula[],
        ) => 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 INamedFormula[]

      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.

    • Serializes to IWorkbook.JSON.names form, or null when there is nothing to write.

      Returns INamed.JSON[] | null

      This is the authority for <definedName> on save. An INamedCollection aggregates several registries — tables among them — and is not.