Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

inherits-ex

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inherits-ex - npm Package Compare versions

Comparing version 1.3.4 to 1.3.5

lib/dynamic-class-decorator.js

13

lib/inherits.js

@@ -5,2 +5,3 @@ var isArray = Array.isArray;

var getPrototypeOf = require('./getPrototypeOf');
var defineProperty = require('./defineProperty');

@@ -31,3 +32,4 @@ var objectSuperCtor = getPrototypeOf(Object);

var result = false;
if (!isInheritedFrom(ctor, superCtor) && !isInheritedFrom(superCtor, ctor)) {
var isInherited = isInheritedFrom(ctor, superCtor)
if (!isInherited && !isInheritedFrom(superCtor, ctor)) {
inheritsDirectly(ctor, superCtor, staticInherit);

@@ -42,2 +44,11 @@ // patch the missing prototype chain if exists ctor.super.

result = true;
} else if (isInherited) {
// additional properties
if (!ctor.hasOwnProperty('super_')) {
defineProperty(ctor, 'super_', superCtor);
defineProperty(ctor.prototype, 'Class', ctor)
}
if (!ctor.hasOwnProperty('__super__')) {
defineProperty(ctor, '__super__', superCtor.prototype);
}
}

@@ -44,0 +55,0 @@ return result;

2

package.json

@@ -5,3 +5,3 @@ {

"homepage": "https://github.com/snowyu/inherits-ex.js",
"version": "1.3.4",
"version": "1.3.5",
"author": {

@@ -8,0 +8,0 @@ "name": "Riceball LEE",

@@ -5,2 +5,3 @@ var isArray = Array.isArray;

var getPrototypeOf = require('./getPrototypeOf');
var defineProperty = require('./defineProperty');

@@ -31,3 +32,4 @@ var objectSuperCtor = getPrototypeOf(Object);

var result = false;
if (!isInheritedFrom(ctor, superCtor) && !isInheritedFrom(superCtor, ctor)) {
var isInherited = isInheritedFrom(ctor, superCtor)
if (!isInherited && !isInheritedFrom(superCtor, ctor)) {
inheritsDirectly(ctor, superCtor, staticInherit);

@@ -42,2 +44,11 @@ // patch the missing prototype chain if exists ctor.super.

result = true;
} else if (isInherited) {
// additional properties
if (!ctor.hasOwnProperty('super_')) {
defineProperty(ctor, 'super_', superCtor);
defineProperty(ctor.prototype, 'Class', ctor)
}
if (!ctor.hasOwnProperty('__super__')) {
defineProperty(ctor, '__super__', superCtor.prototype);
}
}

@@ -44,0 +55,0 @@ return result;

@@ -71,2 +71,14 @@ var chai = require('chai')

it("test inherits with extends parent class", function() {
class B extends A1{
}
inherits(B, A1)
var obj = new B
assert.equal(obj.inited, 'A1')
assert.equal(B.super_, A1)
assert.equal(B.__super__, A1.prototype)
assert.equal(B.prototype.Class, B)
})
it("test inherits and call super parent class", function() {

@@ -73,0 +85,0 @@ class B {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc