Decorators and class names in JavaScript

I was working on a project last week were I was trying to upgrade a JavaScript class using the decorator pattern: function Deck() { /* some constructor */ } var DeckWithState = State.decorate(Deck); var spades = new DeckWithState(); spades.set(‘suit’, Deck.SPADES); The gist here being that you have some base object of your own definition (Deck) […]