Created
February 5, 2016 06:41
-
-
Save fercreek/df08558d040dd0e77fa6 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
"use strict"; | |
const barker = (state) => ({ | |
bark: () => console.log('Woof, I am ' + state.name) | |
}) | |
const driver = (state) => ({ | |
drive: () => state.position = state.position + state.speed | |
}) | |
barker({name: 'karo'}).bark() | |
const murderRobotDog = (name) => { | |
let state = { | |
name, | |
speed: 100, | |
position: 0 | |
} | |
return Object.assign( | |
{}, | |
barker(state), | |
driver(state) | |
// killer(state) | |
) | |
} | |
murderRobotDog('sniffles').bark() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment