Created
April 22, 2020 20:53
-
-
Save markodayan/2e9b86a68cd1e7f7cfb5be7ed0424972 to your computer and use it in GitHub Desktop.
JS imports and exports in webpack env
This file contains hidden or 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 users = [ | |
{ name: 'mario', premium: true }, | |
{ name: 'luigi', premium: false }, | |
{ name: 'yoshi', premium: true }, | |
{ name: 'toad', premium: true }, | |
{ name: 'peach', premium: false }, | |
]; | |
export const getPremUsers = (users) => { | |
return users.filter((user) => { | |
return user.premium === true; | |
}); | |
}; | |
export default users; | |
// alternative way of exporting | |
// export {getPremUsers, users as default} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment