Created
September 29, 2020 12:04
-
-
Save thatkookooguy/a25351b3ed7d342271076e319eba48ee to your computer and use it in GitHub Desktop.
example of require
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 lib = require('./node-module'); | |
const newPizza = new lib.Pizza(); | |
// or | |
const { Pizza, Lazagna, constant } = require('./node-module'); | |
const newPizza = new Pizza(); |
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
class Pizza {} | |
class Lazagna {} | |
module.exports = { | |
Pizza, // or whatever you want to assign it to | |
Lazagna, // again, set it to what you like | |
constant: 5 // an example of a static thing | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment