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

underscore-inherit

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

underscore-inherit - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

20

index.js

@@ -1,2 +0,2 @@

(function() {
(function () {
'use strict';

@@ -10,3 +10,3 @@

_.mixin({
inherit: function (Parent, proto, static) {
inherit: function (Parent, protoProps, staticProps) {

@@ -16,17 +16,17 @@ // `Child` is the passed in `constructor` proto property

var Child =
proto && _.has(proto, 'constructor') ?
proto.constructor :
protoProps && _.has(protoProps, 'constructor') ?
protoProps.constructor :
function () { return Parent.apply(this, arguments); };
// `Dummy` is a dummy function to ensure `Parent.constructor`
// `Dummy` is a dummy constructor to ensure `Parent.constructor`
// isn't actually called as it could have unintended
// side effects
function Dummy() { this.constructor = Child; };
var Dummy = function () { this.constructor = Child; };
// Pass on convenience `__super__` and `static` properties
_.extend(Child, Parent, {__super__: Parent.prototype}, static);
// Pass on static properties
_.extend(Child, Parent, staticProps);
// Set up inheritance and merge `proto` properties
// Set up inheritance and merge prototype properties
Dummy.prototype = Parent.prototype;
Child.prototype = _.extend(new Dummy, proto);
Child.prototype = _.extend(new Dummy(), protoProps);

@@ -33,0 +33,0 @@ // Return the finished constructor

{
"name": "underscore-inherit",
"version": "0.0.1",
"version": "0.0.2",
"author": "Casey Foster <c@sey.me>",

@@ -8,2 +8,2 @@ "devDependencies": {

}
}
}

@@ -20,12 +20,16 @@ underscore-inherit

_.extend(Animal.prototype, {
name: 'Chupacabra'
sound: 'roarmeowbarkmoo',
sing: function () {
alert(Array(5).join(this.sound));
alert(this.name + ' says ' + Array(5).join(this.sound));
}
});
var Dog = _.inherit(Animal, {
name: 'Gunner',
sound: 'woof'
});
var Dog = _.inherit(Animal, {
var Cat = _.inherit(Animal, {
name: 'Mittens',
sound: 'meow'

@@ -32,0 +36,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