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
function add(n) { | |
sum = n; | |
const proxy = new Proxy(function a () {}, { | |
get () { | |
return () => sum; | |
}, | |
apply (receiver, ...args) { | |
sum += args[1][0]; | |
return proxy; | |
} |
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 Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
twiglet: Ember.inject.service(), | |
appName: 'Ember Twiddle', | |
t: Ember.computed('twiglet', function() { | |
return this.get('twiglet').getTwiglet(); | |
}), | |
}); |
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
const R = require('ramda'); | |
/** | |
* wanted a functional way to do this that did not modify the params | |
**/ | |
function deepReplaceInObject(currentValue, newValue, objectToReplaceIn) { | |
const paramType = R.type(objectToReplaceIn); | |
if (paramType === 'Object') { | |
return R.keys(objectToReplaceIn).reduce((object, key) => { | |
const type = R.type(objectToReplaceIn[key]); |