next
Moves a request into a nested key. It takes the same parameters as get(), must be called after it, and can be repeated to go as deep as needed.
Parameter | Description |
|---|---|
| The nested key to request, a string. |
| Optional lex query to return only some of the node's properties. |
| Optional function that receives the data, ending the chain. Leave it out to |
| Optional object, passed after the callback. |
A key that doesn't exist returns null.
Examples
// With await.
const name = await holster.get("item").next("child").next("name")
// With a callback.
holster.get("item").next("child", console.log)
// With a lex query.
const child = await holster.get("item").next("child", {".": "name"})
console.log(child.name)
// With a lex query and a callback.
holster
.get("item")
.next("child", {".": "name"}, child => console.log(child.name))
// Write to a nested key.
await holster.get("item").next("child").next("name").put("nested")
// Listen to a nested node.
holster.get("item").next("child").on(console.log)