class-utils
Advanced tools
Comparing version 0.3.2 to 0.3.3
41
index.js
@@ -338,40 +338,5 @@ 'use strict'; | ||
cu.extend = function extend(Parent, extend) { | ||
if (typeof Parent !== 'function') { | ||
throw new TypeError('expected Parent to be a function.'); | ||
} | ||
return function(Ctor, proto) { | ||
if (typeof Ctor !== 'function') { | ||
throw new TypeError('expected Ctor to be a function.'); | ||
} | ||
util.inherits(Ctor, Parent); | ||
for (var key in Parent) { | ||
Ctor[key] = Parent[key]; | ||
} | ||
if (typeof proto === 'object') { | ||
var obj = Object.create(proto); | ||
for (var k in obj) { | ||
Ctor.prototype[k] = obj[k]; | ||
} | ||
} | ||
utils.define(Ctor.prototype, '_parent_', { | ||
configurable: true, | ||
get: function() { | ||
return Parent.prototype; | ||
}, | ||
set: function() {} | ||
}); | ||
if (typeof extend === 'function') { | ||
extend(Ctor, Parent); | ||
} | ||
Ctor.extend = cu.extend(Ctor, extend); | ||
}; | ||
cu.extend = function() { | ||
// keep it lazy, instead of assigning to `cu.extend` | ||
return utils.staticExtend.apply(null, arguments); | ||
}; | ||
@@ -378,0 +343,0 @@ |
{ | ||
"name": "class-utils", | ||
"description": "Utils for working with JavaScript classes and prototype methods.", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"homepage": "https://github.com/jonschlinkert/class-utils", | ||
@@ -26,13 +26,14 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"isobject": "^2.0.0", | ||
"lazy-cache": "^1.0.3" | ||
"lazy-cache": "^1.0.3", | ||
"static-extend": "^0.1.1" | ||
}, | ||
"devDependencies": { | ||
"gulp": "^3.9.0", | ||
"gulp": "^3.9.1", | ||
"gulp-eslint": "^2.0.0", | ||
"gulp-format-md": "^0.1.7", | ||
"gulp-istanbul": "^0.10.0", | ||
"gulp-jshint": "^1.11.2", | ||
"gulp-mocha": "^2.1.3", | ||
"jshint-stylish": "^2.0.1", | ||
"mocha": "*", | ||
"should": "*" | ||
"gulp-istanbul": "^0.10.3", | ||
"gulp-mocha": "^2.2.0", | ||
"mocha": "^2.4.5", | ||
"should": "^8.2.2", | ||
"through2": "^2.0.1" | ||
}, | ||
@@ -44,2 +45,3 @@ "keywords": [ | ||
"copy", | ||
"ctor", | ||
"define", | ||
@@ -49,4 +51,12 @@ "delegate", | ||
"extend", | ||
"extends", | ||
"inherit", | ||
"inheritance", | ||
"merge", | ||
"method", | ||
"object", | ||
"prop", | ||
"properties", | ||
"property", | ||
"prototype", | ||
"util", | ||
@@ -53,0 +63,0 @@ "utils" |
@@ -226,3 +226,3 @@ # class-utils [![NPM version](https://img.shields.io/npm/v/class-utils.svg)](https://www.npmjs.com/package/class-utils) [![Build Status](https://img.shields.io/travis/jonschlinkert/class-utils.svg)](https://travis-ci.org/jonschlinkert/class-utils) | ||
### [.bubble](index.js#L386) | ||
### [.bubble](index.js#L351) | ||
@@ -282,2 +282,2 @@ Bubble up events emitted from static methods on the Parent ctor. | ||
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on March 09, 2016._ | ||
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on March 11, 2016._ |
12
utils.js
'use strict'; | ||
/** | ||
* Lazily required module dependencies | ||
*/ | ||
var utils = require('lazy-cache')(require); | ||
var fn = require; | ||
require = utils; | ||
/** | ||
* Temporarily re-assign require to trick browserify into | ||
* recognizing lazy requires | ||
* Lazily required module dependencies | ||
*/ | ||
var fn = require; | ||
require = utils; | ||
require('define-property', 'define'); | ||
require('isobject', 'isObj'); | ||
require('static-extend'); | ||
require = fn; | ||
@@ -19,0 +15,0 @@ |
17245
4
339
+ Addedstatic-extend@^0.1.1
+ Addedcopy-descriptor@0.1.1(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedkind-of@3.2.2(transitive)
+ Addedobject-copy@0.1.0(transitive)
+ Addedstatic-extend@0.1.2(transitive)