Class: InternalObjectId

@lumjs/core.InternalObjectId(opts)

A class for creating unique identifier objects. Generally only used by my own inernal libraries, thus the name.

Constructor

new InternalObjectId(opts)

Build a unique InternalObjectId instance.

Parameters:
Name Type Description
opts object

Named options to change default behaviours.

Properties
Name Type Attributes Default Description
name string <optional>

A friendly name for diagnostics.

id string | number <optional>

An internal id value. Default value is a large random number.

property string | Symbol <optional>

The property name or Symbol. This is the property that will be set on objects that are tagged with this InternalObjectId. Default is Symbol(this.id).

useInstance boolean <optional>
true

Store object or id value? If this is true (now the default), we store the instance itself. If this is false (the old default), we store just the id value.

Source:

Methods

is(obj) → {boolean}

Is the specified object tagged with this object id?

Parameters:
Name Type Description
obj *

The object to test.

Source:
Returns:

If it's tagged or not.

Type
boolean

isFunction() → {function}

Generate a function that calls instance.is()

Source:
Returns:

The wrapper function.

Type
function

tag(obj) → {*}

Tag an object with the ObjectId.

Parameters:
Name Type Description
obj *

The object to tag with the unique object id.

Source:
Returns:

obj

Type
*

untag(obj)

Remove the tag from a tagged object.

Parameters:
Name Type Description
obj *
Source: