can-construct-super
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -40,6 +40,22 @@ /* global require, module */ | ||
var getPrototypeOf = Object.getPrototypeOf || function(obj){ | ||
return obj.__proto__; // jshint ignore:line | ||
}; | ||
var getPropertyDescriptor = Object.getPropertyDescriptor || function(subject, name) { | ||
if(name in subject) { | ||
var pd = Object.getOwnPropertyDescriptor(subject, name); | ||
var proto = getPrototypeOf(subject); | ||
while (pd === undefined && proto !== null) { | ||
pd = Object.getOwnPropertyDescriptor(proto, name); | ||
proto = getPrototypeOf(proto); | ||
} | ||
return pd; | ||
} | ||
}; | ||
// overwrites a single property so it can still call super | ||
Construct._overwrite = function (addTo, base, name, val) { | ||
// Check if we're overwriting an existing function | ||
var baseDescriptor = Object.getOwnPropertyDescriptor(base, name); | ||
var baseDescriptor = getPropertyDescriptor(base, name); | ||
var baseValue = baseDescriptor && baseDescriptor.value; | ||
@@ -46,0 +62,0 @@ |
{ | ||
"name": "can-construct-super", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "Provides a reference to the prototypal parent using this._super in can-construct objects", | ||
@@ -5,0 +5,0 @@ "main": "can-construct-super", |
@@ -114,1 +114,14 @@ /* global require, test, stop, start, expect, equal, Promise */ | ||
}); | ||
QUnit.test("_super isn't always available (#11)", function(){ | ||
var Parent = Construct.extend({ | ||
}); | ||
var Child = Parent.extend({ | ||
init: function () { | ||
this._super(); | ||
ok(true); | ||
} | ||
}); | ||
new Child(); | ||
}); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
12740
194
0