Class ArraySet<V>

A set that is backed by an array. Use arraySet to create it.

Type Parameters

  • V

Hierarchy

  • BaseModel<
        {
            $modelId: ModelIdProp<string> & {
                typedAs<T extends string>(): ModelIdProp<T>;
            };
            items: OptionalModelProp<any[]>;
        },
        never,
        never,
        "$modelId",
        this,
    > & Omit<{ $modelId: string; items: any[] }, BaseModelKeys> & {}
    • ArraySet

Implements

  • Set<V>

Constructors

Properties

"[fromSnapshotOverrideTypeSymbol]": never
"[modelIdPropertyNameSymbol]": "$modelId"
"[propsTypeSymbol]": {
    $modelId: ModelIdProp<string> & {
        typedAs<T extends string>(): ModelIdProp<T>;
    };
    items: OptionalModelProp<any[]>;
}
"[toSnapshotOverrideTypeSymbol]": never
"[toStringTag]": "ArraySet"
$: { $modelId: string; items: any[] }

Data part of the model, which is observable and will be serialized in snapshots. Use it if one of the data properties matches one of the model properties/functions.

$modelType: string

Model type name.

items: any[] = ...

Accessors

  • get $modelId(): ModelIdPropertyType<TProps, ModelIdPropertyName>
  • Model internal id. Can be modified inside a model action. It will return undefined if there's no id prop set.

    Returns ModelIdPropertyType<TProps, ModelIdPropertyName>

  • set $modelId(newId: ModelIdPropertyType<TProps, ModelIdPropertyName>): void
  • Parameters

    Returns void

  • get size(): number
  • Returns number

    the number of (unique) elements in Set.

Methods

  • Returns SetIterator<V>

  • Appends a new element with a specified value to the end of the Set.

    Parameters

    • value: V

    Returns this

  • Returns void

  • Removes a specified value from the Set.

    Parameters

    • value: V

    Returns boolean

    Returns true if an element in the Set existed and has been removed, or false if the element does not exist.

  • Type Parameters

    • U

    Parameters

    • other: ReadonlySetLike<U>

    Returns Set<V>

    a new Set containing all the elements in this Set which are not also in the argument.

  • Returns an iterable of [v,v] pairs for every value v in the set.

    Returns SetIterator<[V, V]>

  • Executes a provided function once per each value in the Set object, in insertion order.

    Parameters

    • callbackfn: (value: V, value2: V, set: Set<V>) => void
    • OptionalthisArg: any

    Returns void

  • Can be overridden to offer a reference id to be used in reference resolution. By default it will use the idProp if available or return undefined otherwise.

    Returns undefined | string

  • Parameters

    • value: V

    Returns boolean

    a boolean indicating whether an element with the specified value exists in the Set or not.

  • Type Parameters

    • U

    Parameters

    • other: ReadonlySetLike<U>

    Returns Set<V & U>

    a new Set containing all the elements which are both in this Set and in the argument.

  • Parameters

    • other: ReadonlySetLike<unknown>

    Returns boolean

    a boolean indicating whether this Set has no elements in common with the argument.

  • Parameters

    • other: ReadonlySetLike<unknown>

    Returns boolean

    a boolean indicating whether all the elements in this Set are also in the argument.

  • Parameters

    • other: ReadonlySetLike<unknown>

    Returns boolean

    a boolean indicating whether all the elements in the argument are also in this Set.

  • Despite its name, returns an iterable of the values in the set.

    Returns SetIterator<V>

  • Type Parameters

    • U

    Parameters

    • other: ReadonlySetLike<U>

    Returns Set<V | U>

    a new Set containing all the elements which are in either this Set or in the argument, but not in both.

  • Parameters

    • Optionaloptions: { withData?: boolean }

    Returns string

  • Performs a type check over the model instance. For this to work a data type has to be declared as part of the model properties.

    Returns null | TypeCheckError

    A TypeCheckError or null if there is no error.

  • Type Parameters

    • U

    Parameters

    • other: ReadonlySetLike<U>

    Returns Set<V | U>

    a new Set containing all the elements in this Set and also all the elements in the argument.

  • Returns an iterable of values in the set.

    Returns SetIterator<V>