Parcel keys

Dataparcels automatically gives unique keys to all children of a parent parcel. These can safely be used as unique identifiers for each child parcel, regardless of the child parcel's position within the parent.

Keyed parents

Child Parcels who belong to a keyed data type, such as an object, are given keys that match the keys on the parent data type.

let value = {
    abc: 123,
    def: 456
};

let parcel = new Parcel({value});

parcel.get('abc').key // key is 'abc'
parcel.get('def').key // key is 'def'

Indexed parents

Child Parcels who belong to a indexed data type, such as an array, are given autogenerated keys when the Parcel is first instanciated.

let value = [
   123,
   456
]

let parcel = new Parcel({value});

parcel.get(0).key // key is '#a'
parcel.get(1).key // key is '#b'