Skip to content

Instantly share code, notes, and snippets.

@onyxblade
Created March 21, 2018 10:35
Show Gist options
  • Save onyxblade/2acb79526b56b589fc03e9129d844d29 to your computer and use it in GitHub Desktop.
Save onyxblade/2acb79526b56b589fc03e9129d844d29 to your computer and use it in GitHub Desktop.
function lodash (obj) {
var createProxy = function (obj) {
return new Proxy(obj, {
get (target, name) {
if (_[name]) {
return function (...args) {
var result = _[name](target, ...args)
if (typeof result === 'object') {
return createProxy(result)
} else {
return result
}
}
} else {
return target[name]
}
}
})
}
return createProxy(obj)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment