From f6d9955d399760175a4454ebb6c74e24aeffe131 Mon Sep 17 00:00:00 2001 From: Wes Todd Date: Sat, 20 Feb 2016 10:33:28 -0600 Subject: [PATCH] converted to setPrototypeOf for forward and backward compat --- index.js | 10 ++++++---- package.json | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 929c67e..9e3562d 100644 --- a/index.js +++ b/index.js @@ -4,6 +4,7 @@ * MIT Licensed */ +var setPrototypeOf = require('setprototypeof') /** * Expose `Proto`. @@ -41,7 +42,7 @@ function Proto(protos, options) { var middleware = function setProto() { var i = arguments.length while (i--) { - arguments[i].__proto__ = middleware[_protos[i]].proto + setPrototypeOf(arguments[i], middleware[_protos[i]].proto) } } @@ -50,9 +51,10 @@ function Proto(protos, options) { while (i--) { var name = _protos[i] var prop = middleware[name] = { - proto: { __proto__: protos[name].prototype } + proto: {} , _opts: opts } + setPrototypeOf(prop.proto, protos[name].prototype) prop.defineProperty = defineProperty.bind(prop) prop.defineProperties = defineProperties.bind(prop) } @@ -62,7 +64,7 @@ function Proto(protos, options) { /** - * define a property onto the __proto__ + * define a property onto the prototype */ function defineProperty(name, descriptor) { if (!name) { @@ -90,7 +92,7 @@ function defineProperty(name, descriptor) { /** - * define properties on __proto__ via an object map + * define properties on prototype via an object map */ function defineProperties(props) { if (!props) { diff --git a/package.json b/package.json index 801aa63..d9e3b52 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "inject" ], "dependencies": { + "setprototypeof": "^1.0.1" }, "devDependencies": { "mocha": "^2.0.1",