Skip to main content

Class: ArraySet<V>

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

Extends​

  • arraySetBase

Type Parameters​

Type Parameter
V

Implements​

  • Set<V>

Constructors​

Constructor​

abstract new ArraySet<V>(data): ArraySet<V>;

Parameters​

ParameterType
dataany

Returns​

ArraySet<V>

Inherited from​

arraySetBase.constructor

Properties​

[fromSnapshotOverrideTypeSymbol]​

[fromSnapshotOverrideTypeSymbol]: any;

Inherited from​

arraySetBase.[fromSnapshotOverrideTypeSymbol]

[modelIdPropertyNameSymbol]​

[modelIdPropertyNameSymbol]: any;

Inherited from​

arraySetBase.[modelIdPropertyNameSymbol]

[propsTypeSymbol]​

[propsTypeSymbol]: any;

Inherited from​

arraySetBase.[propsTypeSymbol]

[toSnapshotOverrideTypeSymbol]​

[toSnapshotOverrideTypeSymbol]: any;

Inherited from​

arraySetBase.[toSnapshotOverrideTypeSymbol]

[toStringTag]​

readonly [toStringTag]: "ArraySet" = "ArraySet";

Implementation of​

Set.[toStringTag]

$​

readonly $: object;

items​

items: V[];

Inherited from​

arraySetBase.$

$modelType​

readonly $modelType: string;

Model type name.

Inherited from​

arraySetBase.$modelType

items​

readonly items: V[];

Inherited from​

arraySetBase.items

Accessors​

$modelId​

Get Signature​

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 Signature​

set $modelId(newId): void;
Parameters​
ParameterType
newIdModelIdPropertyType<TProps, ModelIdPropertyName>
Returns​

void

Inherited from​

arraySetBase.$modelId

size​

Get Signature​

get size(): number;
Returns​

number

the number of (unique) elements in Set.

Implementation of​

Set.size

Methods​

[iterator]()​

iterator: SetIterator<V>;

Returns​

SetIterator<V>

Implementation of​

Set.[iterator]

add()​

add(value): this;

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

Parameters​

ParameterType
valueV

Returns​

this

Implementation of​

Set.add

clear()​

clear(): void;

Removes all elements from the Set.

Returns​

void

Implementation of​

Set.clear

delete()​

delete(value): boolean;

Removes a specified value from the Set.

Parameters​

ParameterType
valueV

Returns​

boolean

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

Implementation of​

Set.delete

difference()​

difference<U>(other): Set<V>;

Type Parameters​

Type Parameter
U

Parameters​

ParameterType
otherReadonlySetLike<U>

Returns​

Set<V>

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

Implementation of​

Set.difference

entries()​

entries(): SetIterator<[V, V]>;

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

Returns​

SetIterator<[V, V]>

Implementation of​

Set.entries

forEach()​

forEach(callbackfn, thisArg?): void;

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

Parameters​

ParameterType
callbackfn(value, value2, set) => void
thisArg?any

Returns​

void

Implementation of​

Set.forEach

getRefId()​

getRefId(): string | undefined;

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​

string | undefined

Inherited from​

arraySetBase.getRefId

has()​

has(value): boolean;

Parameters​

ParameterType
valueV

Returns​

boolean

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

Implementation of​

Set.has

intersection()​

intersection<U>(other): Set<V & U>;

Type Parameters​

Type Parameter
U

Parameters​

ParameterType
otherReadonlySetLike<U>

Returns​

Set<V & U>

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

Implementation of​

Set.intersection

isDisjointFrom()​

isDisjointFrom(other): boolean;

Parameters​

ParameterType
otherReadonlySetLike<unknown>

Returns​

boolean

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

Implementation of​

Set.isDisjointFrom

isSubsetOf()​

isSubsetOf(other): boolean;

Parameters​

ParameterType
otherReadonlySetLike<unknown>

Returns​

boolean

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

Implementation of​

Set.isSubsetOf

isSupersetOf()​

isSupersetOf(other): boolean;

Parameters​

ParameterType
otherReadonlySetLike<unknown>

Returns​

boolean

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

Implementation of​

Set.isSupersetOf

keys()​

keys(): SetIterator<V>;

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

Returns​

SetIterator<V>

Implementation of​

Set.keys

symmetricDifference()​

symmetricDifference<U>(other): Set<V | U>;

Type Parameters​

Type Parameter
U

Parameters​

ParameterType
otherReadonlySetLike<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.

Implementation of​

Set.symmetricDifference

toString()​

toString(options?): string;

Parameters​

ParameterType
options?{ withData?: boolean; }
options.withData?boolean

Returns​

string

Inherited from​

arraySetBase.toString

typeCheck()​

typeCheck(): TypeCheckError | null;

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​

TypeCheckError | null

A TypeCheckError or null if there is no error.

Inherited from​

arraySetBase.typeCheck

union()​

union<U>(other): Set<V | U>;

Type Parameters​

Type Parameter
U

Parameters​

ParameterType
otherReadonlySetLike<U>

Returns​

Set<V | U>

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

Implementation of​

Set.union

values()​

values(): SetIterator<V>;

Returns an iterable of values in the set.

Returns​

SetIterator<V>

Implementation of​

Set.values