Last active
April 13, 2017 21:39
-
-
Save adrianpietka/066c96938930947bd9a1e236ecacb3c2 to your computer and use it in GitHub Desktop.
best-practice-js
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
| // composition | |
| const killer = state => { | |
| kill: () => console.log("Heu hue, I kill you!") | |
| } | |
| const barker = state => ({ | |
| bark: () => console.log("Wooof, I am " + state.name) | |
| }) | |
| const murderRobotoDog = name => { | |
| let state = { | |
| name, speed: 150 | |
| } | |
| return Object.assign( | |
| {}, | |
| barker(state), | |
| killer(state) | |
| ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment