classified-magic
Advanced tools
Comparing version 0.0.14 to 0.1.1
@@ -87,3 +87,4 @@ var classified = require('classified'), | ||
method.extend = function(prototype) { | ||
return magic().define(prototype).trait(this.definition()); | ||
this.__isClassified__ = true; | ||
return magic().define(prototype).trait(this); | ||
}; | ||
@@ -90,0 +91,0 @@ |
{ | ||
"name": "classified-magic", | ||
"description": "OOP for NodeJS with magic", | ||
"version": "0.0.14", | ||
"version": "0.1.1", | ||
"author": { | ||
@@ -24,3 +24,3 @@ "name": "Christian Blanquera", | ||
"dependencies": { | ||
"classified": "0.0.17" , | ||
"classified": "0.1.1" , | ||
"node-proxy": "0.8.0" | ||
@@ -27,0 +27,0 @@ }, |
@@ -18,37 +18,39 @@ #Classified Magic | ||
var RootClass = classified(function() { | ||
var prototype = { | ||
//sample constants | ||
SOME_CONSTANT: 'foo', | ||
//sample public properties | ||
data: {}, | ||
sampleProperty: 4.5, | ||
sampleDeepProperty: { | ||
sample1: 'Hello', | ||
sample2: [4, 5, 6, 7], | ||
sample3: { | ||
bool : true, | ||
regex : /^abc/, | ||
date : new Date(), | ||
string : String | ||
} | ||
}, | ||
//sample protected properties | ||
_sampleProperty: 5.5, | ||
_sampleDeepProperty: { | ||
sample1: '_Hello', | ||
sample2: [8, 9, 0, 1] | ||
}, | ||
//sample private properties | ||
__sampleProperty: 6.5, | ||
__sampleDeepProperty: { | ||
sample1: '__Hello', | ||
sample2: [12, 13, 14, 15] | ||
//sample constants | ||
this.SOME_CONSTANT = 'foo'; | ||
//sample public properties | ||
this.data = {}; | ||
this.sampleProperty = 4.5; | ||
this.sampleDeepProperty = { | ||
sample1: 'Hello', | ||
sample2: [4, 5, 6, 7], | ||
sample3: { | ||
bool : true, | ||
regex : /^abc/, | ||
date : new Date(), | ||
string : String | ||
} | ||
}; | ||
//sample protected properties | ||
this._sampleProperty = 5.5; | ||
this._sampleDeepProperty = { | ||
sample1: '_Hello', | ||
sample2: [8, 9, 0, 1] | ||
}; | ||
//sample private properties | ||
this.__sampleProperty = 6.5; | ||
this.__sampleDeepProperty = { | ||
sample1: '__Hello', | ||
sample2: [12, 13, 14, 15] | ||
}; | ||
//sample constructor | ||
prototype.___construct = function() { | ||
this.___construct = function() { | ||
this.constructCalled = true; | ||
@@ -58,3 +60,3 @@ }; | ||
//sample public method | ||
prototype.sampleMethod = function() { | ||
this.sampleMethod = function() { | ||
return this._sampleMethod(); | ||
@@ -64,3 +66,3 @@ }; | ||
//sample protected method | ||
prototype._sampleMethod = function() { | ||
this._sampleMethod = function() { | ||
return this.__sampleMethod(); | ||
@@ -70,7 +72,7 @@ }; | ||
//sample private method | ||
prototype.__sampleMethod = function() { | ||
this.__sampleMethod = function() { | ||
return this.SOME_CONSTANT + this._sampleProperty; | ||
}; | ||
prototype.sampleAccessMethod = function() { | ||
this.sampleAccessMethod = function() { | ||
return this.sampleMethod() | ||
@@ -82,23 +84,21 @@ + this._sampleMethod() | ||
//sample magic methods | ||
prototype.___get = function(name) { | ||
this.___get = function(name) { | ||
return this.data[name]; | ||
}; | ||
prototype.___set = function(name, value) { | ||
this.___set = function(name, value) { | ||
this.data[name] = value; | ||
}; | ||
prototype.___enum = function() { | ||
this.___enum = function() { | ||
return Object.keys(this.data); | ||
}; | ||
prototype.___has = function(name, value) { | ||
this.___has = function(name, value) { | ||
return this.data.hasOwnProperty(name); | ||
}; | ||
prototype.___delete = function(name) { | ||
this.___delete = function(name) { | ||
delete this.data[name]; | ||
}; | ||
return prototype; | ||
}); | ||
@@ -109,12 +109,10 @@ | ||
var ChildClass = RootClass.extend(function() { | ||
var prototype = {}; | ||
//sample constants | ||
prototype.SOME_CONSTANT_2 = 'bar'; | ||
this.SOME_CONSTANT_2 = 'bar'; | ||
//sample protected properties | ||
prototype._sampleProperty = 7.5; | ||
this._sampleProperty = 7.5; | ||
//sample public methods | ||
prototype.sampleMethod = function() { | ||
this.sampleMethod = function() { | ||
return this._sampleMethod(); | ||
@@ -124,7 +122,5 @@ }; | ||
//sample protected methods | ||
prototype._sampleMethod = function() { | ||
this._sampleMethod = function() { | ||
return this.___parent._sampleMethod(); | ||
}; | ||
return prototype; | ||
}); | ||
@@ -131,0 +127,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
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
412
17781
163
+ Addedclassified@0.1.1(transitive)
- Removedclassified@0.0.17(transitive)
Updatedclassified@0.1.1