New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.0.6 to 1.0.7

lib/getProtoChain.js

22

lib/inheritsObject.js
var inherits = require('./inherits');
//make sure the aClass.prototype hook to the aObject instance.
var getPrototypeOf = Object.getPrototypeOf;
if (!getPrototypeOf) {
getPrototypeOf = function(obj) {
return obj.__proto__;
};
}
var setPrototypeOf = Object.setPrototypeOf;
if (!setPrototypeOf) {
setPrototypeOf = function(obj, prototype) {
obj.__proto__ = prototype;
};
}
module.exports = function(aObject, aClass) {
// ES6: Object.getPrototypeOf / Object.setPrototypeOf
var vOldProto = aObject.__proto__;
var vOldProto = getPrototypeOf(aObject);
var result = false;
if ( vOldProto !== aClass.prototype) {
inherits(aClass, vOldProto.constructor);
aObject.__proto__ = aClass.prototype;
setPrototypeOf(aObject, aClass.prototype);
result = true;
}
return result;
}
};

@@ -32,15 +32,44 @@ var inherits = require('./inherits');

*
mixin the exists method: the new mixin method will oerwrite the old one.
```coffee
class Root
m: -> console.log 'root'
m: ->
console.log 'root'
console.log '----'
class C
m: ->
console.log "c"
super
inherits C, Root
m: ->
console.log "c"
super
class B
inherits B, Root
m: ->
console.log "b"
super
class B11
m: ->
console.log 'b11'
super
inherits B11, B
m: ->
console.log 'b11'
super
b = new B11
b.m()
mixin B11, C
b = new B11
b.m()
# The console results:
# b11
# b
# root
# ----
# b11
# c
# root
# ----
```
*

@@ -47,0 +76,0 @@ */

2

package.json

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

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

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

var inherits = require('./inherits');
//make sure the aClass.prototype hook to the aObject instance.
var getPrototypeOf = Object.getPrototypeOf;
if (!getPrototypeOf) {
getPrototypeOf = function(obj) {
return obj.__proto__;
};
}
var setPrototypeOf = Object.setPrototypeOf;
if (!setPrototypeOf) {
setPrototypeOf = function(obj, prototype) {
obj.__proto__ = prototype;
};
}
module.exports = function(aObject, aClass) {
// ES6: Object.getPrototypeOf / Object.setPrototypeOf
var vOldProto = aObject.__proto__;
var vOldProto = getPrototypeOf(aObject);
var result = false;
if ( vOldProto !== aClass.prototype) {
inherits(aClass, vOldProto.constructor);
aObject.__proto__ = aClass.prototype;
setPrototypeOf(aObject, aClass.prototype);
result = true;
}
return result;
}
};

@@ -32,15 +32,44 @@ var inherits = require('./inherits');

*
mixin the exists method: the new mixin method will oerwrite the old one.
```coffee
class Root
m: -> console.log 'root'
m: ->
console.log 'root'
console.log '----'
class C
m: ->
console.log "c"
super
inherits C, Root
m: ->
console.log "c"
super
class B
inherits B, Root
m: ->
console.log "b"
super
class B11
m: ->
console.log 'b11'
super
inherits B11, B
m: ->
console.log 'b11'
super
b = new B11
b.m()
mixin B11, C
b = new B11
b.m()
# The console results:
# b11
# b
# root
# ----
# b11
# c
# root
# ----
```
*

@@ -47,0 +76,0 @@ */

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