nice.Type('Animal')
.string('name')
.number('weight')
.boolean('hasTail')
.by((z, name) => z.name(name));
const jim = nice.Animal('Jim').weight(5);
jim.name(); // Jim
jim.weight(); // 5
// by default created type extends nice.Obj
jim.isObj() // true
Type name should start with capital letter.
nice.Animal.extend('Dog')
.string('breed')
.by((z, name) => z.super(name).hasTail(true));
const buddy = nice.Dog('Buddy');
buddy.hasTail(); //true
buddy.isAnimal(); //true
buddy.isDog(); //true
nice.Func.Animal('voice', () => console.log('Hm'));
nice.Func.Dog('voice', () => console.log('Woof'));
buddy.voice(); // 'Woof'
jim.voice(); // 'Hm'
Here are some of embedded types: