Skip to content

Instantly share code, notes, and snippets.

View ant1m4tt3r's full-sized avatar

Hugo Azevedo ant1m4tt3r

View GitHub Profile
@ant1m4tt3r
ant1m4tt3r / example.js
Last active September 11, 2020 13:00
Object as HOF
// HOFCreator.js -----------
const HOFCreator = {
createProxy(methods, dataContext) {
const handler = {
apply (_, __, property) {
return function (...args) {
return methods[property].call(dataContext, ...args)
}
},
}