See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope> is optional
| /* | |
| 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) | |
| }) |
| // using ES6 Proxy to let Promises/Observables pretend like they're regular values. | |
| // get the mapping function used for async objects | |
| let getMapper = (target) => target instanceof Promise ? 'then' : | |
| target instanceof Observable ? 'switchMap' : null; | |
| // ^ fails if the Observable is in a local namespace e.g. Rx.Observable | |
| // bind a value to its object if it's a function | |
| let bindFn = (val, obj) => typeof val == 'function' ? val.bind(obj) : val; |
| const callerMap = {}; | |
| function getCaller(error) { | |
| if (error && error.stack) { | |
| const lines = error.stack.split('\n'); | |
| if (lines.length > 2) { | |
| let match = lines[2].match(/at ([a-zA-Z\-_$.]+) (.*)/); | |
| if (match) { | |
| return { | |
| name: match[1].replace(/^Proxy\./, ''), |