JSFiddle - React, Tailwind, and code Playground
by Jon-Carlos Rivera
HTML
<script src="http://jon-carlos.com/scripts/masala.js"></script>
JavaScript
var dogFactory = masala(Object.create, {
breed: null,
name: null
}, {
'bark': {
get: function () {
return this.name + ' (a '+ this.breed + ') says "ruff!"';
}
}
});
console.log("dogFactory options remaining:", dogFactory.options);
var pitBullFactory = dogFactory({
breed: 'pitbull'
});
console.log("pitBullFactory options remaining:", pitBullFactory.options);
var cDog = pitBullFactory({
name: 'Cyril'
});
var sDog = pitBullFactory({
name: 'Spot'
});
console.log(cDog.bark);
console.log(sDog.bark);