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 states = { | |
default: '_partials/default', | |
error: '_partials/error', | |
} | |
function compileTemplates(templates) { | |
return Object | |
.keys(templates) | |
.map(key => ({ | |
key, |
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 mix = (baseClass) => ({ | |
with(...mixins) { | |
return mixins.reduce((newClass, mixin) => mixin(newClass), baseClass); | |
} | |
}); | |
const UIStateMixin = (baseClass) => { | |
return class extends baseClass { | |
constructor() { | |
super(...arguments); |
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 fetchUsers = () => { | |
return [ | |
{ name: 'User #1' }, | |
{ name: 'User #2' }, | |
]; | |
} | |
const getUsernames = (users) => { | |
return users.map(user => user.name); | |
} |
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: 'User #1', | |
bookmarks: [ | |
{ title: 'Movie #1', id: 1 }, | |
{ title: 'Movie #6', id: 6 }, | |
{ title: 'Movie #3', id: 3 }, | |
] | |
}, | |
{ |
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 products = [ | |
{ label: 'Product #1', value: 4.25 }, | |
{ label: 'Product #2', value: 2.50 }, | |
{ label: 'Product #3', value: 1.40 }, | |
]; | |
const total = products.reduce((total, { value }) => total + value, 0); /* 8.15 */ |