DEV Community

Discussion on: Splitting Javascript Classes Into Different Files

Collapse
 
plinpod profile image
Plinpod • Edited

I do something similar but since I end up usually importing all the methods in a file I skip adding individual methods to the prototype. Essentially what Joel wrote but still using the class syntax and requiring the file directly.

class Animal {}

Object.assign(Anima.prototype, require('./moo'))