Created
April 6, 2016 16:15
-
-
Save Risto-Stevcev/bdeec5c4fdcce261a129f25a032ab505 to your computer and use it in GitHub Desktop.
where clause
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
// playing around with "where" clause functionality for JS | |
const def = fn => ({ | |
where: obj => (function(obj) { | |
Object.keys(obj).forEach(key => this[key] = obj[key]) | |
fn() | |
})(obj) | |
}) | |
def(() => { | |
console.log(a + b) | |
}).where({ a: 2, b: 5 }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment