vis-util
    Preparing search index...

    Variable optionConst

    option: {
        asBoolean(value: unknown, defaultValue?: boolean): null | boolean;
        asElement<T extends Node>(
            value: undefined | T | (() => undefined | T),
            defaultValue: T,
        ): null | T;
        asNumber(value: unknown, defaultValue?: number): null | number;
        asSize(value: unknown, defaultValue?: string): null | string;
        asString(value: unknown, defaultValue?: string): null | string;
    } = ...

    Type declaration

    • asBoolean: function
      • Convert a value into a boolean.

        Parameters

        • value: unknown

          Value to be converted intoboolean, a function will be executed as (() => unknown).

        • OptionaldefaultValue: boolean

          If the value or the return value of the function == null then this will be returned.

        Returns null | boolean

        Corresponding boolean value, if none then the default value, if none then null.

    • asElement: function
      • Convert a value into a DOM Element.

        Type Parameters

        • T extends Node

        Parameters

        • value: undefined | T | (() => undefined | T)

          Value to be converted into DOM Element, a function will be executed as (() => unknown).

        • defaultValue: T

          If the value or the return value of the function == null then this will be returned.

        Returns null | T

        The DOM Element, if none then the default value, if none then null.

    • asNumber: function
      • Convert a value into a number.

        Parameters

        • value: unknown

          Value to be converted intonumber, a function will be executed as (() => unknown).

        • OptionaldefaultValue: number

          If the value or the return value of the function == null then this will be returned.

        Returns null | number

        Corresponding boxed number value, if none then the default value, if none then null.

    • asSize: function
      • Convert a value into a size.

        Parameters

        • value: unknown

          Value to be converted intosize, a function will be executed as (() => unknown).

        • OptionaldefaultValue: string

          If the value or the return value of the function == null then this will be returned.

        Returns null | string

        Corresponding string value (number + 'px'), if none then the default value, if none then null.

    • asString: function
      • Convert a value into a string.

        Parameters

        • value: unknown

          Value to be converted intostring, a function will be executed as (() => unknown).

        • OptionaldefaultValue: string

          If the value or the return value of the function == null then this will be returned.

        Returns null | string

        Corresponding boxed string value, if none then the default value, if none then null.