Class: ConstraintsMixin

ConstraintsMixin


new ConstraintsMixin()

Used as a manager for Constraints object (validation). Not meant to be used directly.

Properties:
Name Type Description
_constraints Object

private attribute which holds constraints object

Source:
Example
var MyStamp = stampit().compose(ConstraintsMixin);

Methods


<static> getConstraints()

Gets constraints from stampit definition.

Source:
Returns:
Type
Object
Example
var constraints = stampit().compose(ConstraintsMixin).getConstraints();

<static> setConstraints(constraints)

Sets constraints in stampit definition used for validation.

Parameters:
Name Type Description
constraints Object

plain JavaScript object

Source:
Returns:
Type
stampit
Example
var MyStamp = stampit().compose(ConstraintsMixin).setConstraints({});

getConstraints()

Gets constraints from object instance.

Source:
Returns:
Type
Object
Example
var MyStamp = stampit().compose(ConstraintsMixinn);
var constraints = MyStamp().getConstraints();

setConstraints(constraints)

Sets constraints used for validation.

Parameters:
Name Type Description
constraints Object

plain JavaScript object

Source:
Returns:
Type
ConstraintsMixin
Example
var MyStamp = stampit().compose(ConstraintsMixin);
var newObject = MyStamp().setConstraints({});