Parcel Types

Each parcel has one or more parcel types that are determined by the kind of data it contains. Any parcel can be more than one type at once.

You can check a parcel’s type by using their type methods.

Parcel’s can contain any type of value you like, but only a subset of these values will give you the ability to edit child values. A parcel with the ability to edit child values will be of type ParentParcel.

ParentParcel

A parcel is a ParentParcel if its value contains editable child values. Child values are considered editable if they are compatible with the unmutable data collection library. These value types are currently supported:

  • Objects
  • Arrays
  • Immutable.js Maps
  • Immutable.js Lists
  • Immutable.js Records

Unmutable guarantees that data is edited immutably, which is very important for dataparcels.

Class instances are not recognised as ParentParcels because there are no guarantees that they are immutable and Unmutable doesn’t know how to interact with them.

If you want the ability to edit the child values on a data type not listed, please make a request in the unmutable issue tracker.

When a parcel is a parent parcel, it allows the use of branch methods and parent methods.

ChildParcel

A parcel is a ChildParcel if it contains a child value from a parent parcel. Child parcels are created using branching methods.

When a parcel is a child parcel, it allows the use of child methods.

IndexedParcel

A parcel is an IndexedParcel if it contains an indexed data type, such as an array or an Immutable.js List. IndexedParcels are also always parent parcels.

When a parcel is an indexed parcel, it allows the use of indexed methods.

ElementParcel

A parcel is an ElementParcel if it contains the child value of an indexed parcel.

When a parcel is an element parcel, it allows the use of element methods.

TopLevelParcel

A parcel is a TopLevelParcel if it is not a child parcel. Examples: the parcel provided by a ParcelHoc, or a parcel created with new Parcel.