From 4967963fa1d10a870b5195d6aaeb2c206d23f641 Mon Sep 17 00:00:00 2001 From: chee Date: Thu, 23 Feb 2017 21:11:52 +0000 Subject: [PATCH] convert to old fashioned javascript from the 1940s --- index.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) 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) + } } - } -}) + }) +}