Constructor
new Path(parentopt, lastopt)
Create a new Path from its properties
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
parent |
Path |
<optional> |
The parent path |
last |
* |
<optional> |
The latest step |
Classes
Members
last :*
The latest item of this path
Type:
- *
length :number
The length of this Path
Type:
- number
parent :Path|undefined
The parent Path of this path
Type:
- Path | undefined
Methods
across(steps) → {Iterable.<Path>}
Parameters:
| Name | Type | Description |
|---|---|---|
steps |
Iterable.<*> | Steps to extend the path |
Returns:
An iterable producing a new Path for each step
- Type
- Iterable.<Path>
add(item) → {Path}
Parameters:
| Name | Type | Description |
|---|---|---|
item |
* | The next step to add |
Returns:
A new Path with the item appended
- Type
- Path
along(items) → {Path}
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Iterable.<*> | Items to append |
Returns:
A new Path including all appended items
- Type
- Path
isEmpty() → {boolean}
Check if this Path is empty
Returns:
True if the path has no items
- Type
- boolean
isRoot() → {boolean}
Check if this Path has no parent (i.e., is a root path)
Returns:
True if the path has no parent
- Type
- boolean
toArray(nopt, fopt) → {Array.<*>}
Convert the last n steps of this Path into an array
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
n |
number |
<optional> |
this.length | Number of steps to include |
f |
function |
<optional> |
step => step | Function to transform each step |
Returns:
An array containing the last n steps (transformed)
- Type
- Array.<*>
(static) of(…steps) → {Path}
Create a new Path from a list of items
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
steps |
* |
<repeatable> |
The items to include in the path |
Returns:
A new Path containing the given items
- Type
- Path