Socket
Socket
Sign inDemoInstall

class-extend

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

class-extend - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

10

index.js

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

var _ = require('lodash');
'use strict';
var objectAssign = require('object-assign');
var hasOwnProp = Object.prototype.hasOwnProperty;

@@ -20,3 +22,3 @@ var Base = module.exports = function () {};

// by us to simply call the parent's constructor.
if (protoProps && _.has(protoProps, 'constructor')) {
if (protoProps && hasOwnProp.call(protoProps, 'constructor')) {
child = protoProps.constructor;

@@ -28,3 +30,3 @@ } else {

// Add static properties to the constructor function, if supplied.
_.extend(child, parent, staticProps);
objectAssign(child, parent, staticProps);

@@ -43,3 +45,3 @@ // Set the prototype chain to inherit from `parent`

// if supplied.
if (protoProps) _.extend(child.prototype, protoProps);
if (protoProps) objectAssign(child.prototype, protoProps);

@@ -46,0 +48,0 @@ // Set a convenience property in case the parent's prototype is needed

{
"name": "class-extend",
"version": "0.1.1",
"version": "0.1.2",
"description": "Backbone like Class.extend utility for Node",
"main": "index.js",
"scripts": {
"test": "mocha"
},
"repository": {
"type": "git",
"url": "git://github.com/SBoudrias/class-extend.git"
},
"repository": "SBoudrias/class-extend",
"keywords": [

@@ -21,12 +17,12 @@ "inheritance",

"license": "MIT",
"bugs": {
"url": "https://github.com/SBoudrias/class-extend/issues"
},
"homepage": "https://github.com/SBoudrias/class-extend",
"files": [
"index.js"
],
"dependencies": {
"lodash": "~2.4.1"
"object-assign": "^2.0.0"
},
"devDependencies": {
"sinon": "~1.7.3"
"mocha": "^2.1.0",
"sinon": "^1.12.2"
}
}

11

README.md

@@ -9,10 +9,11 @@ Class.extend [![Build Status](https://travis-ci.org/yeoman/generator.png?branch=master)](https://travis-ci.org/SBoudrias/class-extend)

You basically got two options:
``` javascript
var Base = require('base');
// Extend from the blank class
// 1. Extend from the blank class
var Base = require('class-extend');
var Sub = Base.extend();
// Add the .extend helper to a class
MyClass.extend = Base.extend;
// 2. Add the .extend helper to a class
MyClass.extend = require('class-extend').extend;
```

@@ -19,0 +20,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