diff --git a/index.js b/index.js index d3f113c..4f22cec 100644 --- a/index.js +++ b/index.js @@ -13,14 +13,14 @@ const changePrototype = (to, from) => { const wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\n${fromBody}`; -const toStringDescriptors = Object.getOwnPropertyDescriptor(Function.prototype, 'toString'); +const toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString'); const toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name'); const changeToString = (to, from, name) => { const withName = name === '' ? '' : `with ${name.trim()}() `; const newToString = wrappedToString.bind(null, withName, from.toString()); Object.defineProperty(newToString, 'name', toStringName); - Object.defineProperty(to, 'toString', {...toStringDescriptors, value: newToString}); + Object.defineProperty(to, 'toString', {...toStringDescriptor, value: newToString}); }; // If `to` has properties that `from` does not have, remove them