Comparing version 1.0.7 to 1.0.8
@@ -96,2 +96,5 @@ !function(){ | ||
var result; | ||
// check if the new keyword was forgotten | ||
if (!this) throw new Error('the class constructor was called without the «new» keyword!'); | ||
if (this.init) result = this.init.apply(this, Array.prototype.slice.call(arguments)); | ||
@@ -98,0 +101,0 @@ else if (typeof classDefinition.inherits === 'function') classDefinition.inherits.apply(this, Array.prototype.slice.call(arguments)); |
{ | ||
"name" : "ee-class" | ||
, "description" : "A fast prototype based Javascript Class implementation" | ||
, "version" : "1.0.7" | ||
, "version" : "1.0.8" | ||
, "homepage" : "https://github.com/eventEmitter/ee-class" | ||
@@ -6,0 +6,0 @@ , "author" : "Michael van der Weg <michael@eventemitter.com> (http://eventemitter.com/)" |
@@ -297,2 +297,3 @@ # ee-class | ||
- 1.0.6: The class contructor function can now return any type that is not undefined as its instance | ||
- 1.0.7: If the class inherits from a nativa javascript object, it will map the super of the init function to it | ||
- 1.0.7: If the class inherits from a native javascript object it will map the super of the init function to it | ||
- 1.0.8: If a class is instantiated without the new keyword it now throws a menaingful error |
@@ -201,2 +201,13 @@ | ||
describe('[Generic Tests]', function() { | ||
it ('A Class should throw an error when instantiated without the new keyword', function() { | ||
var a = new Class({init: function(){return 2;}}); | ||
assert.throws( | ||
function() { | ||
a(); | ||
} | ||
); | ||
}); | ||
it('#1 - properties', function(){ | ||
@@ -203,0 +214,0 @@ var Person = new Class({ |
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
34738
452
298