Skip to main content

ModelIdMapUtils

Utility class for manipulating and managing ModelIdMap objects. A ModelIdMap is a mapping of model identifiers (strings) to sets of local IDs (numbers). This class provides methods for joining, intersecting, cloning, adding, removing, and comparing ModelIdMap objects, as well as converting between ModelIdMap and plain JavaScript objects.

Methods

add()

static add(target, source, clone): void

Adds all entries from one ModelIdMap to another.

Parameters

ParameterTypeDefault valueDescription
targetModelIdMapundefinedThe ModelIdMap to add to.
sourceModelIdMapundefinedThe ModelIdMap to add from.
clonebooleanfalse-

Returns

void


clone()

static clone(source): ModelIdMap

Creates a deep clone of a ModelIdMap.

Parameters

ParameterTypeDescription
sourceModelIdMapThe ModelIdMap to clone.

Returns

ModelIdMap

A new ModelIdMap with the same model identifiers and localIds as the original.


fromRaw()

static fromRaw(raw): ModelIdMap

Creates a ModelIdMap from a plain JavaScript object with array values.

Parameters

ParameterTypeDescription
rawobjectA plain JavaScript object where each key (model ID) maps to an array of local IDs.

Returns

ModelIdMap

A ModelIdMap.


intersect()

static intersect(maps): ModelIdMap

Creates a new ModelIdMap from the intersection of multiple ModelIdMaps.

Parameters

ParameterTypeDescription
mapsModelIdMap[]An array of ModelIdMaps.

Returns

ModelIdMap

A new ModelIdMap containing only model identifiers and localIds present in all input maps.


isEmpty()

static isEmpty(map): boolean

Checks if a ModelIdMap is empty.

Parameters

ParameterTypeDescription
mapModelIdMapThe ModelIdMap to check.

Returns

boolean

True if the ModelIdMap is empty, false otherwise.


isEqual()

static isEqual(a, b): boolean

Checks if two ModelIdMaps are equal.

Parameters

ParameterTypeDescription
aModelIdMapThe first ModelIdMap.
bModelIdMapThe second ModelIdMap.

Returns

boolean

True if the ModelIdMaps are equal, false otherwise.


join()

static join(maps): ModelIdMap

Creates a new ModelIdMap from the union of multiple ModelIdMaps.

Parameters

ParameterTypeDescription
mapsModelIdMap[]An array of ModelIdMaps to join.

Returns

ModelIdMap

A new ModelIdMap containing all model identifiers and localIds from all input maps.


remove()

static remove(target, source, clone): void

Remove all entries from one ModelIdMap to another.

Parameters

ParameterTypeDefault valueDescription
targetModelIdMapundefinedThe ModelIdMap to subtract from.
sourceModelIdMapundefinedThe ModelIdMap to subtract.
clonebooleanfalse-

Returns

void


toRaw()

static toRaw(map): object

Converts a ModelIdMap into a plain JavaScript object with array values.

Parameters

ParameterTypeDescription
mapModelIdMapThe ModelIdMap to convert.

Returns

object

A plain JavaScript object where each key (model ID) maps to an array of local IDs.