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
import is from './is-util'; | |
/** | |
* Either Monad class (from Functional Programming in JavaScript) | |
*/ | |
class Either { | |
constructor(value) { | |
this._value = value; | |
} | |
get value () { |
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
/* | |
Code examples from the article: S.O.L.I.D The first 5 priciples of Object Oriented Design with JavaScript | |
https://medium.com/@cramirez92/s-o-l-i-d-the-first-5-priciples-of-object-oriented-design-with-javascript-790f6ac9b9fa#.7uj4n7rsa | |
*/ | |
const shapeInterface = (state) => ({ | |
type: 'shapeInterface', | |
area: () => state.area(state) | |
}) |