Constructor
new Pathfinder(object)
Creates a new instance of the constructor.
Name | Type | Description |
---|---|---|
object | object | The object parameter for the constructor. |
- Since
- 1.4.0
- Copyright
- schukai GmbH
- License
- AGPLv3
Throws an error if the provided object parameter is a simple type.
- Type
- Error
import {Pathfinder} from '@schukai/monster/source/data/pathfinder.mjs';
let value = new Pathfinder({
a: {
b: {
f: [
{
g: false,
}
],
}
}
}).getVia("a.b.f.0.g");
console.log(value);
// ↦ false
try {
new Pathfinder({}).getVia("a.b.f.0.g");
} catch (e) {
console.log(e.toString());
// ↦ Error: the journey is not at its end (b.f.0.g)
}
import {Pathfinder} from '@schukai/monster/source/data/pathfinder.mjs';
let p = new Pathfinder({
a: {
x: [
{c: 1}, {c: 2}
],
y: true
},
b: {
x: [
{c: 1, d: false}, {c: 2}
],
y: true
},
});
let r = p.getVia("*.x.*.c");
console.log(r);
Methods
deleteVia(path) → {Pathfinder}
Delete Via Path
.Delete Via Path
Name | Type | Description |
---|---|---|
path | string | |
- Since
- 1.6.0
unsupported type
- Type
- TypeError
value is not a string
- Type
- TypeError
value is not an integer
- Type
- TypeError
unsupported action for this data type
- Type
- Error
- Type:
- Pathfinder
exists(path) → {bool}
Name | Type | Description |
---|---|---|
path | string | |
- Since
- 1.4.0
unsupported type
- Type
- TypeError
value is not a string
- Type
- TypeError
value is not an integer
- Type
- TypeError
- Type:
- bool
getVia(path) → {*}
Name | Type | Description |
---|---|---|
path | string | |
- Since
- 1.4.0
unsupported type
- Type
- TypeError
the journey is not at its end
- Type
- Error
value is not a string
- Type
- TypeError
value is not an integer
- Type
- TypeError
unsupported action for this data type
- Type
- Error
- Type:
- *
setVia(path, value) → {Pathfinder}
Name | Type | Description |
---|---|---|
path | string | | |
value | * |
- Since
- 1.4.0
unsupported type
- Type
- TypeError
value is not a string
- Type
- TypeError
value is not an integer
- Type
- TypeError
unsupported action for this data type
- Type
- Error
- Type:
- Pathfinder
setWildCard(wildcard) → {Pathfinder}
set wildcard
.set wildcard
Name | Type | Description |
---|---|---|
wildcard | string |
- Since
- 1.7.0
- Type:
- Pathfinder