import shape from 'dataparcels/shape';
import shape from 'react-dataparcels/shape';
shape((parcelShape: ParcelShape, changeRequest:?ChangeRequest) => ParcelShape|any) => Function;

The shape function is used to allow the shapes of data to be safely altered inside of an updater, such as those passed to Parcel.update or Parcel.modifyUp. They also provide the ability to set parcel meta.

It must be passed a function, whose first pargument will be a ParcelShape. It will sometimes receive a ChangeRequest as a second parameter depending on what the shape() function is being passed into.

Your updater function should either return another ParcelShape, or if you return anything else, this value will be used instead.

See ParcelShape for more details.

import shape from 'dataparcels/shape';

let parcel = new Parcel({
    value: [1,2,3]

let modifiedParcel = parcel.modifyDown(shape(
    parcelShape => parcelShape

// modifiedParcel.value will be [0,1,2,3,4]