New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

heritable

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

heritable - npm Package Compare versions

Comparing version 0.0.1-3 to 0.0.2-1

lib/nobject.js

11

examples/example1.js

@@ -46,6 +46,8 @@ var Heritable = require('../index.js'),

animal = new Animal({type: 'gorilla'});
eyes.inspect(animal, 'animal: ');
//eyes.inspect(animal, 'animal: ');
console.log('animal type by property: ' + animal.type);
console.log('animal type by getter: ' + animal.getType());
console.log('animal instanceof Animal: ' + (animal instanceof Animal));
console.log('animal.constructor.getClassName(): ' + animal.constructor.getClassName());
console.log('animal.constructor.getUberClass(): ' + animal.constructor.getUberClass());

@@ -59,3 +61,3 @@ Human = new Heritable('Human', Animal, humanInitializer, humanMethods);

human = new Human({name: 'Ryan', age: 'ageless'});
eyes.inspect(human, 'human: ');
//eyes.inspect(human, 'human: ');
console.log('human type by property: ' + human.type);

@@ -71,5 +73,6 @@ console.log('human type by getter: ' + human.getType());

console.log('human.constructor.className: ' + human.constructor.className);
console.log('human.constructor.uberClass.className: ' + human.constructor.uberClass.className);
console.log('human.constructor.getClassName(): ' + human.constructor.getClassName());
console.log('human.constructor.getUberClass(): ' + human.constructor.getUberClass());
console.log('human.constructor.getUberClass().getClassName(): ' + human.constructor.getUberClass().getClassName());

@@ -29,3 +29,3 @@ //

Heritable.prototype = (function () {
var F, // a Function that we re-use for creating prototype objects
var P, // a Function that we re-use for creating prototype objects
hSerialNum, // every Heritable gets a serial number

@@ -40,4 +40,3 @@ iSerialNum, // every Heritable instance gets a serial number

//----------------------------
var K, // a Klass function
S, // will be the super (parent) Heritable for this Heritable
var S, // will be the super (parent) Heritable for this Heritable
hp, // a reference to Heritable's prototype

@@ -51,16 +50,16 @@ p; // used to hold property names (just a generic variable)

// rather than have each instance of C hold a full copy of the constructor code, it is commonalized
C.prototype.constructor.konstructor.call(this, C, arguments);
C.P.konstructor.call(this, C, arguments);
};
C.P = P; // provides access for commoninalization
C.constructor = Heritable; // Heritable constructed the Constructor
// 2. inheritance
S = superHeritable || Object;
F.prototype = S.prototype;
C.prototype = new F(); // an object whose [[prototype]] --> S.prototype
C.prototype.constructor = F; // provides access for commoninalization
C.constructor = Heritable; // Heritable constructed the Constructor
P.prototype = S.prototype;
C.prototype = new P(); // an object whose [[prototype]] --> S.prototype
// 3. meta information
C.serialNum = hSerialNum;
C.uberClass = S;
C.uberClass = (superHeritable) ? superHeritable : null;
C.initializer = initializer;

@@ -95,5 +94,5 @@ C.className = name;

// F's function is the common constructor used when a Heritable creates an instance
F = function () {this.TEMP = 'obj created by F'};
F.konstructor = function (C, arguments) {
// P's function is the constructor invoked to make a Heritable instance
P = function () {this.TEMP = 'obj created by P'};
P.konstructor = function (C, arguments) {
// this refers to the new instance object of C

@@ -149,2 +148,6 @@ var f; // a generic var, sometimes used to hold functions

},
getUberClass: function () {
return this.uberClass;
},

@@ -151,0 +154,0 @@ proxy: function (instance, methodName) {

@@ -29,3 +29,3 @@ {

},
"version": "0.0.1-3"
"version": "0.0.2-1"
}

Sorry, the diff of this file is not supported yet

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