Constructor
# new Pathfinder(value)
Name | Type | Description |
---|---|---|
value |
array | object | Map | Set |
- Since:
- 1.4.0
- Copyright:
- schukai GmbH
-
the parameter must not be a simple type
- Type
- Error
import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/data/pathfinder.js';
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 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.23.0/dist/modules/data/pathfinder.js';
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
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
Name | Type | Description |
---|---|---|
wildcard |
string |
- Since:
- 1.7.0
- Type
- Pathfinder