Skip to content

Instantly share code, notes, and snippets.

@markodayan
Created April 22, 2020 20:53
Show Gist options
  • Save markodayan/2e9b86a68cd1e7f7cfb5be7ed0424972 to your computer and use it in GitHub Desktop.
Save markodayan/2e9b86a68cd1e7f7cfb5be7ed0424972 to your computer and use it in GitHub Desktop.
JS imports and exports in webpack env
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