class-builder
Advanced tools
Comparing version 1.0.3 to 1.0.4
27
index.js
@@ -32,12 +32,2 @@ const BUILD = "build"; | ||
// add each method to instance (must have reference | ||
// to self) | ||
for (var each in _methods) { | ||
Object.defineProperty(self, each, { | ||
value: buildMethod(self, _methods[each]) | ||
}); | ||
} | ||
// workaround how Object.defineProperty works with | ||
@@ -81,2 +71,12 @@ // prototypes to keep properties unenumerable | ||
// add each method to class prototype | ||
for (var each in _methods) { | ||
Object.defineProperty( | ||
constructor.prototype, each, { | ||
value: buildMethod(_methods[each]) | ||
}); | ||
} | ||
// add each property to class prototype | ||
@@ -98,3 +98,2 @@ for (var each in _properties) { | ||
value: buildMethod( | ||
constructor, | ||
_static.methods[each]) | ||
@@ -211,10 +210,10 @@ }); | ||
// | ||
// Creates a method from function, with 'this' = 'self' | ||
// Creates a method from function | ||
// | ||
//---------------------------------------------------------- | ||
function buildMethod(self, method) { | ||
function buildMethod(method) { | ||
return function () { | ||
return method.apply(self, arguments); | ||
return method.apply(this, arguments); | ||
@@ -221,0 +220,0 @@ } |
{ | ||
"name": "class-builder", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Utility for building classes", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
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
5879
218