new ConstraintsMixin()
Used as a manager for Constraints object (validation). Not meant to be used directly.
- Source:
Properties:
Name | Type | Description |
---|---|---|
_constraints |
Object | private attribute which holds constraints object |
Example
var MyStamp = stampit().compose(ConstraintsMixin);
Methods
-
<static> getConstraints()
-
Gets constraints from stampit definition.
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
Returns:
- Type
- stampit
Example
var MyStamp = stampit().compose(ConstraintsMixin).setConstraints({});
-
getConstraints()
-
Gets constraints from object instance.
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
Returns:
- Type
- ConstraintsMixin
Example
var MyStamp = stampit().compose(ConstraintsMixin); var newObject = MyStamp().setConstraints({});