util.normalizeSides(box)

Return a new object of the form { top: Number, bottom: Number, left: Number, right: Number }. The value for each of the side is determined by the argument box. If box is a number, all for sides will have this number. If it is an object with some/all of the right, left, top, bottom properties, these properties will be used. If any of the properties is missing, they will be set to 0 for the related side in the resulting object.

joint.util.normalizeSides(5) // { top: 5, left: 5, right: 5, bottom: 5 }
joint.util.normalizeSides({ left: 5 }) // { top: 0, left: 5, right: 0, bottom: 0 }

JointJS and Rappid use this method internally whenever there is an option object that can be specified either by a number or a (possibly incomplete) object with sides (for example, the padding option).