class-extend
Advanced tools
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" | ||
} | ||
} |
@@ -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 @@ |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
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
61
3445
2
3
42
2
2
1
+ Addedobject-assign@^2.0.0
+ Addedobject-assign@2.1.1(transitive)
- Removedlodash@~2.4.1
- Removedlodash@2.4.2(transitive)