This is part of a set of pull requests aimed at reducing the amount of data being transmitted when using this (excellent 🙏) library extensively, often causing me timeouts in high performance situations. I've split my improvements in different features for your convenience, but I'd be happy to help combine them.
This PR adds a Properties.child(child, index) getter, mirroring the existing Properties.children(child) one:
const all = await ({} as Track).children('clip_slots'); // ClipSlot[]
const one = await ({} as Track).child('clip_slots', 1 ); // ClipSlot | undefined
It is typed to only work with children marked as an array:
For determining this, it will look at the transformed property first.
await ({} as ClipSlot).children('clip'); // Valid: Clip
await ({} as ClipSlot).child('clip', 1); // Invalid: Already a single child
Example
This will drastically reduce the amount of data transmitted when you know the child index in advance:
This PR adds a
Properties.child(child, index)
getter, mirroring the existingProperties.children(child)
one:It is typed to only work with children marked as an array: For determining this, it will look at the transformed property first.
Example
This will drastically reduce the amount of data transmitted when you know the child index in advance: