-
-
Save jkantr/b1a7763405037b4c38158b22ccce3c3d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { createFoo } = require('@foo-bar/core'); | |
// option 1: have the factory/constructor take a 'blueprint' object | |
const myFoo = createFoo({ | |
fooProp: 123, | |
barProp: 'abc', | |
fooFn() { | |
// ... | |
}, | |
barFn() { | |
// ... | |
}, | |
}); | |
// option 2: create a blank Thing (or minimal options Thing) and then append to it | |
const myFoo = createFoo({ barProp: 'abc' }); | |
myFoo.fooFn = function() { | |
// ... | |
} | |
myFoo.barFn = function() { | |
// ... | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment