addyosmani / addyosmani/essential-js-design-patterns
Decorator Pattern extend()
- Dominant language
- HTML
- Stars
- 4.9k
- Forks
- 804
- PR merge metrics
- No merged PRs in 30d
Description
Hi Addy,
I wonder why in this line of code https://github.com/addyosmani/essential-js-design-patterns/blob/21346c134aa953ba469782372c90e42c36a1f083/book/snippets/01-JavaScript-Design-Patterns/12-the-decoration-pattern.es5.js#L255 we are extending `CaseDecorator` with `MacbookDecorator`. As functions, they don't have any enumerable properties by their own yet. Shouldn't happen the extension in the prototype like:
`extend(CaseDecorator.prototype, MacbookDecorator.prototype);`
because trying to do this `console.log(decoratedMacbookPro.addEngraving());` results in a `TypeError: decoratedMacbookPro.addEngraving is not a function`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.