{"_id":"31i73-class","_rev":"7-787ce15fcdc9ac3683154b3baf83ad86","name":"31i73-class","description":"31i73.com simple node.js class library","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"31i73-class","version":"1.0.0","description":"31i73.com simple node.js class library","main":"class.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["31i73","class","prototype","inheritence","multiple inheritence","oop","mixin"],"author":{"name":"ProPuke@31i73.com"},"license":"BSD-2-Clause","repository":{"type":"hg","url":"https://bitbucket.org/31i73/node.js-class"},"homepage":"https://bitbucket.org/31i73/node.js-class","readme":"# 31i73-class\r\n\r\nA simple node.js class library\r\n\r\n## API\r\n\r\nclass( statics [, instanced] )\r\n\r\n* **statics** - An object containing all static class properties.  \r\nThis may also contain the special property `_init` for declaring the initialiser, and `_inherits` for declaring a single or multiple classes to inherit from\r\n* **instanced** - An object containing all instance class properties \r\n\r\n### Create a class\r\n\r\n    var class = require('31i73-class');\r\n\r\n\tvar Person = class({\r\n\t\t_init: function(name){\r\n\t\t\tthis.name = name;\r\n\t\t\tthis.age = undefined;\r\n\t\t}\r\n\t},{\r\n\t\tget_name: function(){ return this.name; },\r\n\t\tset_name: function(set){ this.name = set; },\r\n\r\n\t\tget_age: function(){ return this.age; },\r\n\t\tset_age: function(set){ this.age = set; }\r\n\t});\r\n\r\n\tvar bob = new Person('bob');\r\n\tbob.set_age(42);\r\n\r\n### Static methods\r\n\r\n\tvar Person = class({\r\n\t\t_init: function(name){\r\n\t\t\tthis.name = name;\r\n\t\t\tthis.age = undefined;\r\n\t\t},\r\n\t\tcreate_adult: function(name){\r\n\t\t\tvar create = new Person(name);\r\n\t\t\tcreate.set_age(24);\r\n\t\t\treturn create;\r\n\t\t},\r\n\t\tcreate_child: function(name){\r\n\t\t\tvar create = new Person(name);\r\n\t\t\tcreate.set_age(12);\r\n\t\t\treturn create;\r\n\t\t}\r\n\t},{\r\n\t\tget_name: function(){ return this.name; },\r\n\t\tset_name: function(set){ this.name = set; },\r\n\r\n\t\tget_age: function(){ return this.age; },\r\n\t\tset_age: function(set){ this.age = set; }\r\n\t});\r\n\r\n\tvar littly_timmy = Person.create_child('Timmy');\r\n\r\n### Inheritence\r\n\r\n\tvar Animal = class({\r\n\t\t_init: function(name){\r\n\t\t\tthis.name = name;\r\n\t\t\tthis.soundeffect = undefined;\r\n\t\t}\r\n\t},{\r\n\t\tset_soundeffect: function(path){\r\n\t\t\tthis.soundeffect = new Soundeffect(path);\r\n\t\t}\r\n\t});\r\n\r\n\tvar Horse = class({\r\n\t\t_inherits: Animal,\r\n\t\t_init: function(){\r\n\t\t\tAnimal.call(this,'horse');\r\n\t\t\tthis.set_soundeffect('horse.wav');\r\n\t\t}\r\n\t});\r\n\r\n\t//Multiple inheritence\r\n\tvar Mule = class({\r\n\t\t_inherits: [\r\n\t\t\tHorse,\r\n\t\t\tDonkey\r\n\t\t],\r\n\t\t_init: function(){\r\n\t\t\tAnimal.call(this,'mule');\r\n\t\t\tthis.set_soundeffect('mule.wav');\r\n\t\t}\r\n\t});\r\n\r\n\t//a missing initialiser causes the first inherited classes initialiser to be called, instead\r\n\tvar Shire_horse = class({\r\n\t\t_inherits: Horse\r\n\t});\r\n","readmeFilename":"readme.md","_id":"31i73-class@1.0.0","dist":{"shasum":"2cb1645520372452cb98e6359a3db7e2855159b5","tarball":"https://registry.npmjs.org/31i73-class/-/31i73-class-1.0.0.tgz","integrity":"sha512-XOdwZU6/+BZBplEDm8Yj3TZhje1EXXZigO6c8Qhp8MegdG5+iDL9ndhd3WSLi41q2Ru9YnsWLS4Hek6zjmhGyA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDAUVEWL+GXhyILabIhEN1qOmsbXkM/cWiTTYZYr58o8QIgKepjOWZnqLgAWvCQn4mfduj+VWzCu6lgm3S8jjpJ8Rc="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"propuke","email":"ProPuke@gmail.com"},"maintainers":[{"name":"propuke","email":"ProPuke@gmail.com"}]},"1.1.0":{"name":"31i73-class","version":"1.1.0","description":"31i73.com simple node.js class library","main":"31i73-class.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["31i73","class","prototype","inheritence","multiple inheritence","oop","mixin"],"author":{"name":"ProPuke@31i73.com"},"license":"BSD-2-Clause","repository":{"type":"hg","url":"https://bitbucket.org/31i73/node.js-class"},"homepage":"https://bitbucket.org/31i73/node.js-class","readme":"# 31i73-class\r\n\r\nA simple node.js class library\r\n\r\n## API\r\n\r\nClass( statics [, instanced] )\r\n\r\n* **statics** - An object containing all static class properties.  \r\nThis may also contain the special property `_init` for declaring the initialiser, and `_inherits` for declaring a single or multiple classes to inherit from\r\n* **instanced** - An object containing all instance class properties \r\n\r\n### Create a class\r\n\r\n    var Class = require('31i73-class');\r\n\r\n\tvar Person = Class({\r\n\t\t_init: function(name){\r\n\t\t\tthis.name = name;\r\n\t\t\tthis.age = undefined;\r\n\t\t}\r\n\t},{\r\n\t\tget_name: function(){ return this.name; },\r\n\t\tset_name: function(set){ this.name = set; },\r\n\r\n\t\tget_age: function(){ return this.age; },\r\n\t\tset_age: function(set){ this.age = set; }\r\n\t});\r\n\r\n\tvar bob = new Person('bob');\r\n\tbob.set_age(42);\r\n\r\n### Static methods\r\n\r\n\tvar Person = Class({\r\n\t\t_init: function(name){\r\n\t\t\tthis.name = name;\r\n\t\t\tthis.age = undefined;\r\n\t\t},\r\n\t\tcreate_adult: function(name){\r\n\t\t\tvar create = new Person(name);\r\n\t\t\tcreate.set_age(24);\r\n\t\t\treturn create;\r\n\t\t},\r\n\t\tcreate_child: function(name){\r\n\t\t\tvar create = new Person(name);\r\n\t\t\tcreate.set_age(12);\r\n\t\t\treturn create;\r\n\t\t}\r\n\t},{\r\n\t\tget_name: function(){ return this.name; },\r\n\t\tset_name: function(set){ this.name = set; },\r\n\r\n\t\tget_age: function(){ return this.age; },\r\n\t\tset_age: function(set){ this.age = set; }\r\n\t});\r\n\r\n\tvar littly_timmy = Person.create_child('Timmy');\r\n\r\n### Inheritence\r\n\r\n\tvar Animal = Class({\r\n\t\t_init: function(name){\r\n\t\t\tthis.name = name;\r\n\t\t\tthis.soundeffect = undefined;\r\n\t\t}\r\n\t},{\r\n\t\tset_soundeffect: function(path){\r\n\t\t\tthis.soundeffect = new Soundeffect(path);\r\n\t\t}\r\n\t});\r\n\r\n\tvar Horse = Class({\r\n\t\t_inherits: Animal,\r\n\t\t_init: function(){\r\n\t\t\tAnimal.call(this,'horse');\r\n\t\t\tthis.set_soundeffect('horse.wav');\r\n\t\t}\r\n\t});\r\n\r\n\t//Multiple inheritence\r\n\tvar Mule = Class({\r\n\t\t_inherits: [\r\n\t\t\tHorse,\r\n\t\t\tDonkey\r\n\t\t],\r\n\t\t_init: function(){\r\n\t\t\tAnimal.call(this,'mule');\r\n\t\t\tthis.set_soundeffect('mule.wav');\r\n\t\t}\r\n\t});\r\n\r\n\t//a missing initialiser causes the first inherited classes initialiser to be called, instead\r\n\tvar Shire_horse = Class({\r\n\t\t_inherits: Horse\r\n\t});\r\n\r\n### Abstract class\r\n\r\n\tvar Animal = Class({\r\n\t\t_abstract: true,\r\n\t},{\r\n\t\tget_name: Class.abstract,\r\n\t\tget_size: Class.abstract\r\n\t});\r\n\r\n\t//attempting to create a non-abstract class with abstract methods will generate an exception\r\n\tvar Donkey = Class({\r\n\t\t_inherits: Animal\r\n\t},{\r\n\t\tget_name: function(){ return 'donkey'; }\r\n\t});\r\n\t// Error: Class contains abstract method: get_size\r\n\r\n\t//all is right this time..\r\n\tvar Donkey = Class({\r\n\t\t_inherits: Animal\r\n\t},{\r\n\t\tget_name: function(){ return 'donkey'; },\r\n\t\tget_size: function(){ 4; }\r\n\t});\r\n","readmeFilename":"readme.md","_id":"31i73-class@1.1.0","dist":{"shasum":"97aaf67b94d6a23eae7b28aebcdcf602a9d22e20","tarball":"https://registry.npmjs.org/31i73-class/-/31i73-class-1.1.0.tgz","integrity":"sha512-lBdzm65DXXkUBemydotnUcF0+HKQp2EsbRV5usQR/KbtFudVM5l/50Nw7fe/j9dk0mYfdzB3Zv6gj1gKngdVmQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCuO90IndKB28plv23bn4Ks75cx3J3XP/cDIWIbmhg56wIhAKSCLBmfH9mmeH2RK+/EZFGCm7xQJjTTVQpKhmFjllNb"}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"propuke","email":"ProPuke@gmail.com"},"maintainers":[{"name":"propuke","email":"ProPuke@gmail.com"}]}},"readme":"# 31i73-class\r\n\r\nA simple node.js class library\r\n\r\n## API\r\n\r\nclass( statics [, instanced] )\r\n\r\n* **statics** - An object containing all static class properties.  \r\nThis may also contain the special property `_init` for declaring the initialiser, and `_inherits` for declaring a single or multiple classes to inherit from\r\n* **instanced** - An object containing all instance class properties \r\n\r\n### Create a class\r\n\r\n    var class = require('31i73-class');\r\n\r\n\tvar Person = class({\r\n\t\t_init: function(name){\r\n\t\t\tthis.name = name;\r\n\t\t\tthis.age = undefined;\r\n\t\t}\r\n\t},{\r\n\t\tget_name: function(){ return this.name; },\r\n\t\tset_name: function(set){ this.name = set; },\r\n\r\n\t\tget_age: function(){ return this.age; },\r\n\t\tset_age: function(set){ this.age = set; }\r\n\t});\r\n\r\n\tvar bob = new Person('bob');\r\n\tbob.set_age(42);\r\n\r\n### Static methods\r\n\r\n\tvar Person = class({\r\n\t\t_init: function(name){\r\n\t\t\tthis.name = name;\r\n\t\t\tthis.age = undefined;\r\n\t\t},\r\n\t\tcreate_adult: function(name){\r\n\t\t\tvar create = new Person(name);\r\n\t\t\tcreate.set_age(24);\r\n\t\t\treturn create;\r\n\t\t},\r\n\t\tcreate_child: function(name){\r\n\t\t\tvar create = new Person(name);\r\n\t\t\tcreate.set_age(12);\r\n\t\t\treturn create;\r\n\t\t}\r\n\t},{\r\n\t\tget_name: function(){ return this.name; },\r\n\t\tset_name: function(set){ this.name = set; },\r\n\r\n\t\tget_age: function(){ return this.age; },\r\n\t\tset_age: function(set){ this.age = set; }\r\n\t});\r\n\r\n\tvar littly_timmy = Person.create_child('Timmy');\r\n\r\n### Inheritence\r\n\r\n\tvar Animal = class({\r\n\t\t_init: function(name){\r\n\t\t\tthis.name = name;\r\n\t\t\tthis.soundeffect = undefined;\r\n\t\t}\r\n\t},{\r\n\t\tset_soundeffect: function(path){\r\n\t\t\tthis.soundeffect = new Soundeffect(path);\r\n\t\t}\r\n\t});\r\n\r\n\tvar Horse = class({\r\n\t\t_inherits: Animal,\r\n\t\t_init: function(){\r\n\t\t\tAnimal.call(this,'horse');\r\n\t\t\tthis.set_soundeffect('horse.wav');\r\n\t\t}\r\n\t});\r\n\r\n\t//Multiple inheritence\r\n\tvar Mule = class({\r\n\t\t_inherits: [\r\n\t\t\tHorse,\r\n\t\t\tDonkey\r\n\t\t],\r\n\t\t_init: function(){\r\n\t\t\tAnimal.call(this,'mule');\r\n\t\t\tthis.set_soundeffect('mule.wav');\r\n\t\t}\r\n\t});\r\n\r\n\t//a missing initialiser causes the first inherited classes initialiser to be called, instead\r\n\tvar Shire_horse = class({\r\n\t\t_inherits: Horse\r\n\t});\r\n","maintainers":[{"name":"propuke","email":"ProPuke@gmail.com"}],"time":{"modified":"2022-06-12T14:07:09.955Z","created":"2013-12-17T04:53:49.421Z","1.0.0":"2013-12-17T04:53:53.376Z","1.1.0":"2014-01-05T18:01:52.080Z"},"author":{"name":"ProPuke@31i73.com"},"repository":{"type":"hg","url":"https://bitbucket.org/31i73/node.js-class"}}