base-class-extend
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -138,8 +138,18 @@ // base-class.js | ||
// add methods and class methods if not found (in prototype chain) | ||
if (!('private' in proto)) proto.private = BaseClass_private; | ||
if (!('extend' in ctor)) ctor.extend = BaseClass_extend; | ||
if (!('new' in ctor)) ctor.new = BaseClass_new; | ||
if (!('constructors' in ctor)) | ||
Object.defineProperty(ctor, 'constructors', | ||
Object.getOwnPropertyDescriptor(getProto(BaseClass), 'constructors')); | ||
if (!('private' in proto)) proto.private = BaseClass_private; | ||
if (!('constructors' in proto)) | ||
Object.defineProperty(proto, 'constructors', | ||
Object.getOwnPropertyDescriptor(BaseClass.prototype, 'constructors')); | ||
// constructor.super_ -> for points super class | ||
setConst(ctor, 'super_', superCtor); | ||
setConst(ctor, 'super', superCtor); | ||
@@ -190,5 +200,20 @@ return ctor; | ||
var BaseClass = BaseClass_extend('BaseClass', | ||
{private: BaseClass_private}, | ||
{private: BaseClass_private, | ||
get constructors() { | ||
var ctors = [], obj = this; | ||
while (obj) { | ||
if (obj.hasOwnProperty('constructor')) | ||
ctors.push(obj.constructor); | ||
obj = getProto(obj); } | ||
return ctors; }}, | ||
{extend: BaseClass_extend, | ||
new: BaseClass_new}); | ||
new: BaseClass_new, | ||
get constructors() { | ||
var ctors = [], ctor = this; | ||
while (ctor) { | ||
if (typeof ctor === 'function' && | ||
ctor.hasOwnProperty('prototype')) | ||
ctors.push(ctor); | ||
ctor = getProto(ctor); } | ||
return ctors; }}); | ||
@@ -195,0 +220,0 @@ |
{ | ||
"name": "base-class-extend", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Base Class constructor for easy class definition - supports getter/setter, inherit/extend Array Error or EventEmitter etc", | ||
"main": "lib/base-class.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/LightSpeedWorks/base-class" | ||
}, | ||
"keywords": [ | ||
@@ -23,8 +16,15 @@ "Array", | ||
], | ||
"author": "LightSpeedC", | ||
"license": "MIT", | ||
"homepage": "https://github.com/LightSpeedWorks/base-class", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/LightSpeedWorks/base-class" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/LightSpeedWorks/base-class/issues" | ||
}, | ||
"homepage": "https://github.com/LightSpeedWorks/base-class" | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "LightSpeedC", | ||
"license": "MIT" | ||
} |
@@ -1,5 +0,5 @@ | ||
base-class-extend | ||
[base-class-extend](https://www.npmjs.org/package/base-class-extend) - npm | ||
==== | ||
BaseClass.extend defines classes in JavaScript.<br/> | ||
[BaseClass.extend](https://www.npmjs.org/package/base-class-extend) defines classes in JavaScript.<br/> | ||
This is simple module providing a simple Class function to | ||
@@ -43,3 +43,9 @@ simplify class definition in JavaScript. | ||
+ **proto**: the prototype object for your class, optional | ||
+ **new** or **constructor**: constructor function, optional | ||
+ **get** getter or **set** setter: getter/setter, optional | ||
+ **any methods**: any method or member function, optional | ||
+ **classProps**: the object for class or static properties, optional | ||
+ **init** or **initialize**: initialize function, optional | ||
+ **get** getter or **set** setter: getter/setter, optional | ||
+ **any methods**: any static method or class function, optional | ||
@@ -181,2 +187,4 @@ ### Returns | ||
+ **proto**: the prototype object contains methods accessing private variables, required | ||
+ **get** getter or **set** setter: getter/setter, optional | ||
+ **any methods**: any method or member function, optional | ||
@@ -183,0 +191,0 @@ ### Returns |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
404223
19
804
343
1