Constructor
new BooleanList(values, optionsopt)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
values |
Array | Map | Object | Elements of the List.
This should only contain booleans or |
||
options |
Object |
<optional> |
{}
|
Further options. |
Extends
Classes
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 |
||||||||||||
options |
Object |
<optional> |
{}
|
Further options. Properties
|
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 |
|||||||||||||||||
options |
Object |
<optional> |
{}
|
Further options. Properties
|
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 |
||
options.name |
string |
<optional> <nullable> |
null
|
See the argument of the same name in |
options.inPlace |
boolean |
<optional> |
false
|
Whether to modify this List instance in place.
If |
Returns:
The List after deleting the name
d element.
If inPlace = true
, this is a reference to the current instance, otherwise a new instance is created and returned.
- Type
- List
get(i)
Parameters:
Name | Type | Description |
---|---|---|
i |
string | number | Index or name of the List element to retrieve.
Numbers are passed to |
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 |
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 |
Returns:
The List element corresponding to name
.
If duplicates of name
are present in the list, the first occurrence is returned.
has(name) → {boolean}
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}
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
i |
string | number | Index or name of the list element to set.
Numbers are passed to |
|||||||||||||||||
x |
* | Value of a List element. |
|||||||||||||||||
options |
Object |
<optional> |
{}
|
Further options. Properties
|
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 |
||
x |
boolean |
<nullable> |
Value of a List element as a boolean or |
|
options |
Object |
<optional> |
{}
|
Further options, see |
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 |
||
x |
boolean |
<nullable> |
Value of a List element as a boolean or |
|
options |
Object |
<optional> |
{}
|
Further options, see |
Returns:
The List after setting the name
d 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 |
|||||||||||
options |
Object |
<optional> |
{}
|
Further options. Properties
|
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
|
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
|
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