Comparing version 1.1.0 to 1.1.1
@@ -273,2 +273,45 @@ 'use strict'; | ||
// create an array ontop of a function | ||
local.emulateArray = function (a_input, z_cover) { | ||
// prep redefine hash | ||
var h_redefine = {}; | ||
// remove all properties from function | ||
var as_properties = new Set(); | ||
// start proto at object itself | ||
var w_proto = a_input; | ||
// repeat until we've reached the end of the __proto__ chain | ||
while (w_proto !== null) { | ||
// get all properties this prototype would catch | ||
Object.getOwnPropertyNames(w_proto).forEach(function (s_property) { | ||
// property is already defined; continue | ||
if (as_properties.has(s_property)) return; | ||
// now we have visited this property | ||
as_properties.add(s_property); | ||
// set redefine descriptor | ||
h_redefine[s_property] = Object.getOwnPropertyDescriptor(w_proto, s_property); | ||
}); | ||
// continue up next __proto__ ancester | ||
w_proto = w_proto.__proto__; | ||
} | ||
// write final descriptor hash onto cover | ||
Object.defineProperties(z_cover, h_redefine); | ||
// now, redefine length again with writable setting true | ||
h_redefine.length.writable = true; | ||
Object.defineProperty(z_cover, 'length', h_redefine.length); | ||
// return cover | ||
return z_cover; | ||
}; | ||
// set real symbol | ||
@@ -275,0 +318,0 @@ local.real = $_REAL; |
{ | ||
"name": "rmprop", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Override all properties inhereted by an object's prototype chain", | ||
@@ -5,0 +5,0 @@ "author": { |
15717
240