diff --git a/index.js b/index.js index 59c9591..4572039 100644 --- a/index.js +++ b/index.js @@ -1,10 +1,11 @@ -const error = key => new Error(`Object does not contain ${key}`) -module.exports = object => new Proxy(object, { - get: (object, key) => { - if (key in object) { - return object[key] - } else { - throw error(key) +module.exports = function (object) { + return new Proxy(object, { + get: function (object, key) { + if (key in object) { + return object[key] + } else { + throw new Error('Object does not contain ' + key) + } } - } -}) + }) +}