IntegerList

IntegerList

Subclass of a List that only contains integers or nulls. If a null is present, it should be treated as a missing value.

Constructor

new IntegerList(values, optionsopt)

Source:
Parameters:
Name Type Attributes Default Description
values Array | Map | Object

Elements of the List. This should only contain integers or nulls.

options Object <optional>
{}

Further options.

Extends

Classes

IntegerList

Methods

delete(i, optionsopt) → {List}

Source:
Overrides:
Parameters:
Name Type Attributes Default Description
i string | number

Index or name of the List element to delete. Numbers are passed to deleteByIndex and strings are passed to deleteByName.

options Object <optional>
{}

Further options.

Properties
Name Type Attributes Default Description
inPlace boolean <optional>
false

Whether to modify this List instance in place. If false, a new instance is returned.

Returns:

The List after deleting the i-th element. If inPlace = true, this is a reference to the current instance, otherwise a new instance is created and returned.

Type
List

deleteByIndex(i, optionsopt) → {List}

Source:
Overrides:
Parameters:
Name Type Attributes Default Description
i number

Index of the List element to delete. This should be non-negative and no less than length.

options Object <optional>
{}

Further options.

Properties
Name Type Attributes Default Description
name string <optional>
<nullable>
null

See the argument of the same name in setByName.

inPlace boolean <optional>
false

Whether to modify this List instance in place. If false, a new instance is returned.

Returns:

The List after deleting the i-th element. If inPlace = true, this is a reference to the current instance, otherwise a new instance is created and returned.

Type
List

deleteByName(name) → {List}

Source:
Overrides:
Parameters:
Name Type Attributes Default Description
name string

Name of the List element to delete. This should already exist in names.

options.name string <optional>
<nullable>
null

See the argument of the same name in setByName.

options.inPlace boolean <optional>
false

Whether to modify this List instance in place. If false, a new instance is returned.

Returns:

The List after deleting the named element. If inPlace = true, this is a reference to the current instance, otherwise a new instance is created and returned.

Type
List

get(i)

Source:
Overrides:
Parameters:
Name Type Description
i string | number

Index or name of the List element to retrieve. Numbers are passed to getByIndex and strings are passed to getByName.

Returns:

The List element at/for i.

getByIndex(i)

Source:
Overrides:
Parameters:
Name Type Description
i number

Index of the List element to retrieve. This should be non-negative and less than length.

Returns:

The i-th List element.

getByName(name)

Source:
Overrides:
Parameters:
Name Type Description
name string

Name of the List element to retrieve. This should be present in names.

Returns:

The List element corresponding to name. If duplicates of name are present in the list, the first occurrence is returned.

has(name) → {boolean}

Source:
Overrides:
Parameters:
Name Type Description
name string

Name of a List element.

Returns:

Whether the name exists in this List.

Type
boolean

length() → {number}

Source:
Overrides:
Returns:

Length of the list.

Type
number

names() → (nullable) {Array}

Source:
Overrides:
Returns:

Array of names of the List elements, or null if the List is unnamed.

Type
Array

nameToIndex(name) → {number}

Source:
Overrides:
Parameters:
Name Type Description
name string

Name of a List element.

Returns:

Index of the name in names. If duplicate names are present, the first occurrence is returned. If the name is not present, -1 is returned.

Type
number

set(i, x, optionsopt) → {List}

Source:
Overrides:
Parameters:
Name Type Attributes Default Description
i string | number

Index or name of the list element to set. Numbers are passed to setByIndex and strings are passed to setByName.

x *

Value of a List element.

options Object <optional>
{}

Further options.

Properties
Name Type Attributes Default Description
name string <optional>
<nullable>
null

See the argument of the same name in setByName. Only used if i is a number.

inPlace boolean <optional>
false

Whether to modify this List instance in place. If false, a new instance is returned.

Returns:

The List after setting the i-th element to x. If inPlace = true, this is a reference to the current instance, otherwise a new instance is created and returned.

Type
List

setByIndex(i, xnullable, optionsopt) → {List}

Source:
Overrides:
Parameters:
Name Type Attributes Default Description
i number

Index of the List element to set, see List.setByIndex for details.

x number <nullable>

Value of a List element as an integer or null.

options Object <optional>
{}

Further options, see List.setByIndex for details.

Returns:

The List after setting the i-th element to x, see List.setByIndex for details.

Type
List

setByName(name, xnullable, optionsopt) → {List}

Source:
Overrides:
Parameters:
Name Type Attributes Default Description
name string

Name of the List element to set, see List.setByName for details.

x number <nullable>

Value of a List element as an integer or null.

options Object <optional>
{}

Further options, see List.setByName for details.

Returns:

The List after setting the named entry to x, see List.setByName for details.

Type
List

setNames(namesnullable, optionsopt) → {List}

Source:
Overrides:
Parameters:
Name Type Attributes Default Description
names Array <nullable>

Array of strings of length equal to length. This may contain duplicates. Alternatively null, to remove existing names.

options Object <optional>
{}

Further options.

Properties
Name Type Attributes Default Description
inPlace boolean <optional>
false

Whether to modify this List instance in place. If false, a new instance is returned.

Returns:

The List after replacing the names with names. If inPlace = true, this is a reference to the current instance, otherwise a new instance is created and returned.

Type
List

sliceIndices(indices, optionsopt) → {List}

Source:
Overrides:
Parameters:
Name Type Attributes Default Description
indices Array

Array of numbers or strings specifying the List elements to retain in the slice. Numbers are interpreted as positional indices while strings are interpreted as names.

options Object <optional>
{}

Further options.

Properties
Name Type Attributes Default Description
inPlace boolean <optional>
false

Whether to modify this List instance in place. If false, a new instance is returned.

Returns:

A List containing the specified elements in indices. If inPlace = true, this is a reference to the current instance, otherwise a new instance is created and returned.

Type
List

sliceRange(start, end, optionsopt) → {List}

Source:
Overrides:
Parameters:
Name Type Attributes Default Description
start number

Index of the first element in the slice.

end number

Index past the last element in the slice.

options Object <optional>
{}

Further options.

Properties
Name Type Attributes Default Description
inPlace boolean <optional>
false

Whether to modify this List instance in place. If false, a new instance is returned.

Returns:

A List that is sliced to [start, end). If inPlace = true, this is a reference to the current instance, otherwise a new instance is created and returned.

Type
List

toArray() → {Array}

Source:
Overrides:
Returns:

Array of values, equivalent to values.

Type
Array

toMap() → {Map}

Source:
Overrides:
Returns:

Map of name-value pairs. If duplicate names are present, only the value for the first occurrence is reported. If the List is unnamed, an error is thrown.

Type
Map

toObject() → {Object}

Source:
Overrides:
Returns:

Object of name-value pairs. If duplicate names are present, only the value for the first occurrence is reported. If the List is unnamed, an error is thrown.

Type
Object

values() → {Array}

Source:
Overrides:
Returns:

Array containing the List elements.

Type
Array