inherits-ex
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -26,5 +26,5 @@ var isArray = Array.isArray; | ||
var result = false; | ||
if (!isInheritedFrom(ctor, superCtor)) { | ||
if (!isInheritedFrom(ctor, superCtor) && !isInheritedFrom(superCtor, ctor)) { | ||
inheritsDirectly(ctor, superCtor); | ||
while (v != null && (superCtor !== v)) { | ||
while (v != null && superCtor !== v) { | ||
ctor = superCtor; | ||
@@ -31,0 +31,0 @@ superCtor = v; |
@@ -5,2 +5,8 @@ var isInheritedFromStr = require('./isInheritedFromStr'); | ||
if ('string' === typeof superCtor) return isInheritedFromStr(ctor, superCtor, throwError); | ||
if (ctor === superCtor) { | ||
if (throwError) | ||
throw new Error("Circular inherits found!"); | ||
else | ||
return true; | ||
} | ||
var result = ctor.super_ === superCtor; | ||
@@ -7,0 +13,0 @@ var checkeds = []; |
module.exports = function(ctor, superStr, throwError) { | ||
if (ctor.name === superStr) { | ||
if (throwError) | ||
throw new Error("Circular inherits found!"); | ||
else | ||
return true; | ||
} | ||
var result = ctor.super_ != null && ctor.super_.name === superStr; | ||
@@ -3,0 +9,0 @@ var checkeds = []; |
@@ -79,3 +79,3 @@ var inherits = require('./inherits'); | ||
var result = false; | ||
if (!isMixinedFrom(ctor, superCtor) && !isInheritedFrom(ctor, superCtor)) { | ||
if (!isMixinedFrom(ctor, superCtor) && !isInheritedFrom(ctor, superCtor) && !isInheritedFrom(superCtor, ctor)) { | ||
var mixinCtor = ctor.mixinCtor_; | ||
@@ -90,5 +90,3 @@ var mixinCtors = ctor.mixinCtors_; | ||
clonePrototype(mixinCtor, superCtor); | ||
ctor.super_ = mixinCtor; | ||
ctor.__super__ = mixinCtor.prototype; //for coffeeScirpt super keyword. | ||
ctor.prototype = newPrototype(mixinCtor, ctor); | ||
inheritsDirectly(ctor, mixinCtor); | ||
result = true; | ||
@@ -95,0 +93,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://github.com/snowyu/inherits-ex.js", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"author": { | ||
@@ -8,0 +8,0 @@ "name": "Riceball LEE", |
@@ -26,5 +26,5 @@ var isArray = Array.isArray; | ||
var result = false; | ||
if (!isInheritedFrom(ctor, superCtor)) { | ||
if (!isInheritedFrom(ctor, superCtor) && !isInheritedFrom(superCtor, ctor)) { | ||
inheritsDirectly(ctor, superCtor); | ||
while (v != null && (superCtor !== v)) { | ||
while (v != null && superCtor !== v) { | ||
ctor = superCtor; | ||
@@ -31,0 +31,0 @@ superCtor = v; |
@@ -5,2 +5,8 @@ var isInheritedFromStr = require('./isInheritedFromStr'); | ||
if ('string' === typeof superCtor) return isInheritedFromStr(ctor, superCtor, throwError); | ||
if (ctor === superCtor) { | ||
if (throwError) | ||
throw new Error("Circular inherits found!"); | ||
else | ||
return true; | ||
} | ||
var result = ctor.super_ === superCtor; | ||
@@ -7,0 +13,0 @@ var checkeds = []; |
module.exports = function(ctor, superStr, throwError) { | ||
if (ctor.name === superStr) { | ||
if (throwError) | ||
throw new Error("Circular inherits found!"); | ||
else | ||
return true; | ||
} | ||
var result = ctor.super_ != null && ctor.super_.name === superStr; | ||
@@ -3,0 +9,0 @@ var checkeds = []; |
@@ -79,3 +79,3 @@ var inherits = require('./inherits'); | ||
var result = false; | ||
if (!isMixinedFrom(ctor, superCtor) && !isInheritedFrom(ctor, superCtor)) { | ||
if (!isMixinedFrom(ctor, superCtor) && !isInheritedFrom(ctor, superCtor) && !isInheritedFrom(superCtor, ctor)) { | ||
var mixinCtor = ctor.mixinCtor_; | ||
@@ -90,5 +90,3 @@ var mixinCtors = ctor.mixinCtors_; | ||
clonePrototype(mixinCtor, superCtor); | ||
ctor.super_ = mixinCtor; | ||
ctor.__super__ = mixinCtor.prototype; //for coffeeScirpt super keyword. | ||
ctor.prototype = newPrototype(mixinCtor, ctor); | ||
inheritsDirectly(ctor, mixinCtor); | ||
result = true; | ||
@@ -95,0 +93,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41205
36
628