made with esnextbin
Created
January 25, 2017 00:41
-
-
Save TylorS/62ca0fad3b1dba674f8cc48496102325 to your computer and use it in GitHub Desktop.
Motorcycle's Future in a nutshell
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>ESNextbin Sketch</title> | |
<!-- put additional styles and scripts here --> | |
</head> | |
<body> | |
<!-- put markup and other contents here --> | |
</body> | |
</html> |
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
run(main, (sinks) => { | |
const augmentWithUserRepository = augmentAsStream(UserRepository) | |
const registerUserSources = | |
augmentWithUserRepository(RegisterUser)(sinks) | |
const signInUserSources = | |
augmentWithUserRepostiory(SignInUser)(sinks) | |
const user$ = mergeArray([ | |
registerUserSources.user$, | |
signInUserSources.user$, | |
]) | |
return { user$ } | |
}) | |
function augmentAsStream(param, Component) { // curried | |
return function (sinks) { | |
return Component({...sinks, param$: just(param) }) | |
} | |
} | |
function RegisterUser(sinks) { | |
const { userRepository$, userCredentials$ } = sinks; | |
const user$ = combineArray(registerUser, [ userRepository$, userCredentials$ ]) | |
return { user$ } | |
} | |
function registerUser (userRepository, userCredential) { | |
return userRepostiory.registerUser(userCredential); | |
} |
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
{ | |
"name": "esnextbin-sketch", | |
"version": "0.0.0", | |
"dependencies": { | |
"babel-runtime": "6.20.0" | |
} | |
} |
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"; | |
var _extends2 = require("babel-runtime/helpers/extends"); | |
var _extends3 = _interopRequireDefault(_extends2); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
run(main, function (sinks) { | |
var augmentWithUserRepository = augmentAsStream(UserRepository); | |
var registerUserSources = augmentWithUserRepository(RegisterUser)(sinks); | |
var signInUserSources = augmentWithUserRepostiory(SignInUser)(sinks); | |
var user$ = mergeArray([registerUserSources.user$, signInUserSources.user$]); | |
return { user$: user$ }; | |
}); | |
function augmentAsStream(param, Component) { | |
// curried | |
return function (sinks) { | |
return Component((0, _extends3.default)({}, sinks, { param$: just(param) })); | |
}; | |
} | |
function RegisterUser(sinks) { | |
var userRepository$ = sinks.userRepository$; | |
var userCredentials$ = sinks.userCredentials$; | |
var user$ = combineArray(registerUser, [userRepository$, userCredentials$]); | |
return { user$: user$ }; | |
} | |
function registerUser(userRepository, userCredential) { | |
return userRepostiory.registerUser(userCredential); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment