Traits

Traits are Composable Units of Behaviour (You can read more from this paper). Basically, a Trait is a Class, but a special type of Class that has only behaviour (methods) and no state. Traits are an alternative to reuse behaviour in a more predictable manner. They are more robust than Mixins, or Multiple Inheritance since name collisions must be solved by the developer beforehand. If you compose your class with one or more Traits and you have a method defined in more than one place, your program will fail giving no magic rule or any kind of precedence definition.

var cocktail = require ( 'cocktail' ), Login = require ( './trait/login' ); cocktail . mix ({ '@exports' : module , '@as' : 'class' , '@traits' : [ Login ] });

Read More: Starting with Traits