{"_id":"o3","_rev":"8-6d8bad58e715dd8defc8692e31f540c6","name":"o3","description":"o3 - Javascript Class Framework","dist-tags":{"latest":"1.0.3"},"versions":{"0.9.0":{"name":"o3","version":"0.9.0","description":"o3 - Javascript Class Framework","keywords":["inheritance","javascript","class","ES5","object-oriented","class"],"license":"MIT","author":{"name":"László Lajos Jánszky"},"repository":{"type":"git","url":"git+https://github.com/inf3rno/o3.git"},"bugs":{"url":"https://github.com/inf3rno/o3/issues"},"main":"index.js","scripts":{"test":"jasmine"},"dependencies":{},"devDependencies":{"jasmine":">=2.2.0"},"gitHead":"0aa91acf787405bad4229625412a5f7b3cb5abde","homepage":"https://github.com/inf3rno/o3#readme","_id":"o3@0.9.0","_shasum":"b8748ed8a49b8e30c3cc62b70a21f92914b4993d","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"inf3rno","email":"laszlo.janszky@gmail.com"},"maintainers":[{"name":"inf3rno","email":"laszlo.janszky@gmail.com"}],"dist":{"shasum":"b8748ed8a49b8e30c3cc62b70a21f92914b4993d","tarball":"https://registry.npmjs.org/o3/-/o3-0.9.0.tgz","integrity":"sha512-KATgNof9kKcAeGVv89Ig9Bq7A9y/nCtCd8C8kdrnpwwxrwBE4WuSaDX6GZm2emePh7A4lkom/AOYuVyvWgEC+g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGzuR+dLUQedB8HYzwc7acF756GWokkTPs2170yzuyV7AiAkdCkWSU5zfsYqcdzersEH5fz9d5SyzRG55n6VRqV9dg=="}]},"directories":{}},"1.0.0":{"name":"o3","version":"1.0.0","description":"o3 - Javascript Class Framework","keywords":["inheritance","javascript","class","ES5","object-oriented","class"],"license":"MIT","author":{"name":"László Lajos Jánszky"},"repository":{"type":"git","url":"git+https://github.com/inf3rno/o3.git"},"bugs":{"url":"https://github.com/inf3rno/o3/issues"},"main":"index.js","scripts":{"test":"npm run test-node & npm run test-karma","test-node":"mocha --reporter spec yadda.js","test-karma":"karma start karma.conf.js"},"dependencies":{},"devDependencies":{"browserify":"10.2.6","expect.js":"^0.3.1","karma":"^0.13.22","karma-browserify":"^5.0.2","karma-chrome-launcher":"^1.0.1","karma-firefox-launcher":"^1.0.0","karma-ie-launcher":"^1.0.0","karma-mocha":"^0.2.2","karma-phantomjs-launcher":"^1.0.0","mocha":"^2.4.5","phantomjs-prebuilt":"^2.1.5","sinon":"^1.17.3","watchify":"^3.7.0","yadda":"^0.17.2"},"gitHead":"3596d744e94bce712b725a8d009ee549b57945b5","homepage":"https://github.com/inf3rno/o3#readme","_id":"o3@1.0.0","_shasum":"c68eca4d282a00346455b78da772677542966617","_from":".","_npmVersion":"2.11.1","_nodeVersion":"4.2.1","_npmUser":{"name":"inf3rno","email":"laszlo.janszky@gmail.com"},"maintainers":[{"name":"inf3rno","email":"laszlo.janszky@gmail.com"}],"dist":{"shasum":"c68eca4d282a00346455b78da772677542966617","tarball":"https://registry.npmjs.org/o3/-/o3-1.0.0.tgz","integrity":"sha512-yQRRkEvxM+IDOPCFWUYyZMdUhiEV/i8UMtpxUarDUyetCKC4887TOnusVuTNfNd28IZB4nNlwFo1d4xQc7VyxQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDff0126sEGvRWtZZIevQ2OBMsT28TTGSrKzex4gdzwpAiBODCTstB8T3sPTq2PBOejWUVZ/l7UH3FzLE5IzMvaQRQ=="}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/o3-1.0.0.tgz_1471002489295_0.6535034312400967"},"directories":{}},"1.0.1":{"name":"o3","version":"1.0.1","description":"o3 - Javascript Class Framework","keywords":["inheritance","javascript","class","ES5","object-oriented","class"],"license":"MIT","author":{"name":"László Lajos Jánszky"},"repository":{"type":"git","url":"git+https://github.com/inf3rno/o3.git"},"bugs":{"url":"https://github.com/inf3rno/o3/issues"},"main":"index.js","scripts":{"test":"npm run test-node & npm run test-karma","test-node":"mocha --reporter spec yadda.js","test-karma":"karma start karma.conf.js"},"dependencies":{"capability":"^0.2.1"},"devDependencies":{"browserify":"10.2.6","expect.js":"^0.3.1","karma":"^0.13.22","karma-browserify":"^5.0.2","karma-chrome-launcher":"^1.0.1","karma-firefox-launcher":"^1.0.0","karma-ie-launcher":"^1.0.0","karma-mocha":"^0.2.2","karma-phantomjs-launcher":"^1.0.0","mocha":"^2.4.5","phantomjs-prebuilt":"^2.1.5","sinon":"^1.17.3","watchify":"^3.7.0","yadda":"^0.17.2"},"gitHead":"2d81bd7cb32fa5c7f8131fa942db0f51544ef312","homepage":"https://github.com/inf3rno/o3#readme","_id":"o3@1.0.1","_shasum":"2d56ce14c4157a097750d0964919b56051b6542e","_from":".","_npmVersion":"2.11.1","_nodeVersion":"4.2.1","_npmUser":{"name":"inf3rno","email":"laszlo.janszky@gmail.com"},"maintainers":[{"name":"inf3rno","email":"laszlo.janszky@gmail.com"}],"dist":{"shasum":"2d56ce14c4157a097750d0964919b56051b6542e","tarball":"https://registry.npmjs.org/o3/-/o3-1.0.1.tgz","integrity":"sha512-dOP9PCDWAZ731vxrLtVWq9SoFCOhMFTssw/hloDI6E3aCcun8Mqa0qzIKNd44llNjVP4QBCtudfgHM7cUa990g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBb4xsjHc4P8qnhFEFJzv7jsmLyx02P60mZ10QEJ6QExAiBI+1C/SQ+YO06oS1x6mfjkNuAonWS0uXZ1SNPCJeOB5w=="}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/o3-1.0.1.tgz_1471566803604_0.4698603965807706"},"directories":{}},"1.0.2":{"name":"o3","version":"1.0.2","description":"o3 - Javascript Class Framework","keywords":["inheritance","javascript","class","ES5","object-oriented","class"],"license":"MIT","author":{"name":"László Lajos Jánszky"},"repository":{"type":"git","url":"git+https://github.com/inf3rno/o3.git"},"bugs":{"url":"https://github.com/inf3rno/o3/issues"},"main":"index.js","scripts":{"test":"npm run test-node & npm run test-karma","test-node":"mocha --reporter spec yadda.js","test-karma":"karma start karma.conf.js"},"dependencies":{"capability":"^0.2.2"},"devDependencies":{"browserify":"10.2.6","expect.js":"^0.3.1","karma":"^0.13.22","karma-browserify":"^5.0.2","karma-chrome-launcher":"^1.0.1","karma-firefox-launcher":"^1.0.0","karma-ie-launcher":"^1.0.0","karma-mocha":"^0.2.2","karma-phantomjs-launcher":"^1.0.0","mocha":"^2.4.5","phantomjs-prebuilt":"^2.1.5","sinon":"^1.17.3","watchify":"^3.7.0","yadda":"^0.17.2"},"gitHead":"14afd689dd6f61f4b932e7d536863be73211ac0f","homepage":"https://github.com/inf3rno/o3#readme","_id":"o3@1.0.2","_shasum":"6105a18129d81a77841ca446b292c151a5c00e1f","_from":".","_npmVersion":"2.11.1","_nodeVersion":"4.2.1","_npmUser":{"name":"inf3rno","email":"laszlo.janszky@gmail.com"},"maintainers":[{"name":"inf3rno","email":"laszlo.janszky@gmail.com"}],"dist":{"shasum":"6105a18129d81a77841ca446b292c151a5c00e1f","tarball":"https://registry.npmjs.org/o3/-/o3-1.0.2.tgz","integrity":"sha512-5vyqfc3183doJ393kYXSa5wmcfP1GY85Lmdl2AD3Zy7nAEuFAZgnIXcolijxckNUATblRqWWrN3z9Q929DVjug==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCzlCKoMkNdSjFNY6S7tD+3tWVAB7J0ILloFm9fJDg6eAIhAJbd0MCQwT0sHocUk6UBfyqmeo6u/SfQLQLd+WE3f9+k"}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/o3-1.0.2.tgz_1471649890634_0.8401167606934905"},"directories":{}},"1.0.3":{"name":"o3","version":"1.0.3","description":"o3 - Javascript Class Framework","keywords":["inheritance","javascript","class","ES5","object-oriented","class","abstract method"],"license":"MIT","author":{"name":"László Lajos Jánszky"},"repository":{"type":"git","url":"git+https://github.com/inf3rno/o3.git"},"bugs":{"url":"https://github.com/inf3rno/o3/issues"},"main":"index.js","scripts":{"test":"npm run test-node & npm run test-karma","test-node":"mocha --reporter spec yadda.js","test-karma":"karma start karma.conf.js"},"dependencies":{"capability":"^0.2.5"},"devDependencies":{"browserify":"10.2.6","expect.js":"^0.3.1","karma":"^0.13.22","karma-browserify":"^5.0.2","karma-chrome-launcher":"^1.0.1","karma-firefox-launcher":"^1.0.0","karma-ie-launcher":"^1.0.0","karma-mocha":"^0.2.2","karma-phantomjs-launcher":"^1.0.0","mocha":"^2.4.5","phantomjs-prebuilt":"^2.1.5","sinon":"^1.17.3","watchify":"^3.7.0","yadda":"^0.17.2"},"gitHead":"070f61047bb2d36250a06e6d213862fa9d6f0f80","homepage":"https://github.com/inf3rno/o3#readme","_id":"o3@1.0.3","_shasum":"192ce877a882dfa6751f0412a865fafb2da1dac0","_from":".","_npmVersion":"2.11.1","_nodeVersion":"4.2.1","_npmUser":{"name":"inf3rno","email":"laszlo.janszky@gmail.com"},"maintainers":[{"name":"inf3rno","email":"laszlo.janszky@gmail.com"}],"dist":{"shasum":"192ce877a882dfa6751f0412a865fafb2da1dac0","tarball":"https://registry.npmjs.org/o3/-/o3-1.0.3.tgz","integrity":"sha512-f+4n+vC6s4ysy7YO7O2gslWZBUu8Qj2i2OUJOvjRxQva7jVjYjB29jrr9NCjmxZQR0gzrOcv1RnqoYOeMs5VRQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCwWWajzbBM4oENZ943Gt51RSGwPZWROKEUKIeffGsr3wIhANOGi3xNC3jiZPaKRak+/0IrlZnorMGBmu+SDZKMQLII"}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/o3-1.0.3.tgz_1472430825718_0.1830329664517194"},"directories":{}}},"readme":"# Ozone - Javascript Class Framework\r\n\r\n[![Build Status](https://travis-ci.org/inf3rno/o3.png?branch=master)](https://travis-ci.org/inf3rno/o3)\r\n\r\nThe Ozone class framework contains enhanced class support to ease the development of object-oriented javascript applications in an ES5 environment.\r\nAnother alternative to get a better class support to use ES6 classes and compilers like Babel, Traceur or TypeScript until native ES6 support arrives.\r\n\r\n## Documentation\r\n\r\n### Installation\r\n\r\n```bash\r\nnpm install o3\r\n```\r\n\r\n```bash\r\nbower install o3\r\n```\r\n\r\n#### Environment compatibility\r\n\r\nThe framework succeeded the tests on\r\n\r\n - node v4.2 and v5.x\r\n - chrome 51.0\r\n - firefox 47.0 and 48.0\r\n - internet explorer 11.0\r\n - phantomjs 2.1\r\n \r\nby the usage of npm scripts under win7 x64.\r\n\r\nI wasn't able to test the framework by Opera since the Karma launcher is buggy, so I decided not to support Opera.\r\n\r\nI used [Yadda](https://github.com/acuminous/yadda) to write BDD tests.\r\nI used [Karma](https://github.com/karma-runner/karma) with [Browserify](https://github.com/substack/node-browserify) to test the framework in browsers.\r\n\r\nOn pre-ES5 environments there will be bugs in the Class module due to pre-ES5 enumeration and the lack of some ES5 methods, so pre-ES5 environments are not supported.\r\n\r\n#### Requirements\r\n\r\nAn ES5 capable environment is required with\r\n\r\n- `Object.create`\r\n- ES5 compatible property enumeration: `Object.defineProperty`, `Object.getOwnPropertyDescriptor`, `Object.prototype.hasOwnProperty`, etc.\r\n- `Array.prototype.forEach`\r\n\r\n#### Usage\r\n\r\nIn this documentation I used the framework as follows:\r\n\r\n```js\r\nvar o3 = require(\"o3\"),\r\n    Class = o3.Class;\r\n```\r\n\r\n### Inheritance\r\n\r\n#### Inheriting from native classes (from the Error class in these examples)\r\n\r\nYou can extend native classes by calling the Class() function.\r\n\r\n```js\r\nvar UserError = Class(Error, {\r\n    prototype: {\r\n        message: \"blah\",\r\n        constructor: function UserError() {\r\n            Error.captureStackTrace(this, this.constructor);\r\n        }\r\n    }\r\n}); \r\n```\r\n\r\nAn alternative to call Class.extend() with the Ancestor as the context. The Class() function uses this in the background.\r\n\r\n```js\r\nvar UserError = Class.extend.call(Error, {\r\n    prototype: {\r\n        message: \"blah\",\r\n        constructor: function UserError() {\r\n            Error.captureStackTrace(this, this.constructor);\r\n        }\r\n    }\r\n});\r\n```\r\n\r\n#### Inheriting from custom classes\r\n\r\nYou can use Class.extend() by any other class, not just by native classes.\r\n\r\n```js\r\nvar Ancestor = Class(Object, {\r\n    prototype: {\r\n        a: 1,\r\n        b: 2\r\n    }\r\n});\r\n\r\nvar Descendant = Class.extend.call(Ancestor, {\r\n    prototype: {\r\n        c: 3\r\n    }\r\n});\r\n```\r\n\r\nOr you can simply add it as a static method, so you don't have to pass context any time you want to use it. The only drawback, that this static method will be inherited as well.\r\n\r\n```js\r\nvar Ancestor = Class(Object, {\r\n    extend: Class.extend,\r\n    prototype: {\r\n        a: 1,\r\n        b: 2\r\n    }\r\n});\r\n\r\nvar Descendant = Ancestor.extend({\r\n    prototype: {\r\n        c: 3\r\n    }\r\n});\r\n```\r\n\r\n#### Inheriting from the Class class\r\n\r\nYou can inherit the extend() method and other utility methods from the Class class. Probably this is the simplest solution if you need the Class API and you don't need to inherit from special native classes like Error. \r\n\r\n```js\r\nvar Ancestor = Class.extend({\r\n    prototype: {\r\n        a: 1,\r\n        b: 2\r\n    }\r\n});\r\n\r\nvar Descendant = Ancestor.extend({\r\n    prototype: {\r\n        c: 3\r\n    }\r\n});\r\n```\r\n\r\n#### Inheritance with clone and merge\r\n\r\nThe static extend() method uses the clone() and merge() utility methods to inherit from the ancestor and add properties from the config.\r\n\r\n```js\r\nvar MyClass = Class.clone.call(Object, function MyClass(){\r\n    // ...\r\n});\r\nClass.merge.call(MyClass, {\r\n    prototype: {\r\n        x: 1, \r\n        y: 2\r\n    }\r\n});\r\n```\r\n\r\nOr with utility methods.\r\n\r\n```js\r\nvar MyClass = Class.clone(function MyClass() {\r\n    // ...\r\n}).merge({\r\n    prototype: {\r\n        x: 1,\r\n        y: 2\r\n    }\r\n});\r\n```\r\n\r\n#### Inheritance with clone and absorb\r\n\r\nYou can fill in missing properties with the usage of absorb.\r\n\r\n```js\r\nvar MyClass = Class(SomeAncestor, {...});\r\nClass.absorb.call(MyClass, Class);\r\nMyClass.merge({...});\r\n```\r\n\r\nFor example if you don't have Class methods and your class already has an ancestor, then you can use absorb() to add Class methods.\r\n\r\n#### Abstract classes\r\n\r\nUsing abstract classes with instantiation verification won't be implemented in this lib, however we provide an `abstractMethod`, which you can put to not implemented parts of your abstract class.\r\n\r\n```js\r\nvar AbstractA = Class({\r\n    prototype: {\r\n        doA: function (){\r\n            // ...\r\n            var b = this.getB();\r\n            // ...\r\n            // do something with b\r\n            // ...\r\n        },\r\n        getB: abstractMethod\r\n    }\r\n});\r\n\r\nvar AB1 = Class(AbstractA, {\r\n    prototype: {\r\n        getB: function (){\r\n            return new B1();\r\n        }\r\n    }\r\n});\r\n\r\nvar ab1 = new AB1();\r\n\r\n```\r\n\r\nI strongly support the composition over inheritance principle and I think you should use dependency injection instead of abstract classes.\r\n\r\n```js\r\nvar A = Class({\r\n    prototype: {\r\n        init: function (b){\r\n            this.b = b;\r\n        },\r\n        doA: function (){\r\n            // ...\r\n            // do something with this.b\r\n            // ...\r\n        }\r\n    }\r\n});\r\n\r\nvar b = new B1();\r\nvar ab1 = new A(b);\r\n```\r\n\r\n### Constructors\r\n\r\n#### Using a custom constructor\r\n\r\nYou can pass your custom constructor as a config option by creating the class.\r\n\r\n```js\r\nvar MyClass = Class(Object, {\r\n    prototype: {\r\n        constructor: function () {\r\n            // ...\r\n        }\r\n    }\r\n});\r\n```\r\n\r\n#### Using a custom factory to create the constructor\r\n\r\nOr you can pass a static factory method to create your custom constructor.\r\n\r\n```js\r\nvar MyClass = Class(Object, {\r\n    factory: function () {\r\n        return function () {\r\n            // ...\r\n        }\r\n    }\r\n});\r\n```\r\n\r\n#### Using an inherited factory to create the constructor\r\n\r\nBy inheritance the constructors of the descendant classes will be automatically created as well.\r\n\r\n```js\r\nvar Ancestor = Class(Object, {\r\n    factory: function () {\r\n        return function () {\r\n            // ...\r\n        }\r\n    }\r\n});\r\nvar Descendant = Class(Ancestor, {});\r\n```\r\n\r\n#### Using the default factory to create the constructor\r\n\r\nYou don't need to pass anything if you need a noop function as constructor. The Class.factory() will create a noop constructor by default.\r\n\r\n```js\r\nvar MyClass = Class(Object, {});\r\n```\r\n\r\nIn fact you don't need to pass any arguments to the Class function if you need an empty class inheriting from the Object native class.\r\n\r\n```js\r\nvar MyClass = Class();\r\n```\r\n\r\nThe default factory calls the build() and init() methods if they are given.\r\n\r\n```js\r\nvar MyClass = Class({\r\n    prototype: {\r\n        build: function (options) {\r\n            console.log(\"build\", options);\r\n        },\r\n        init: function (options) {\r\n            console.log(\"init\", options);\r\n        }\r\n    }\r\n});\r\n\r\nvar my = new MyClass({a: 1, b: 2});\r\n    // build {a: 1, b: 2}\r\n    // init {a: 1, b: 2}\r\n\r\nvar my2 = my.clone({c: 3});\r\n    // build {c: 3}\r\n\r\nvar MyClass2 = MyClass.extend({}, [{d: 4}]);\r\n    // build {d: 4}\r\n\r\n```\r\n\r\n### Instantiation\r\n\r\n#### Creating new instance with the new operator\r\n\r\nOfc. you can create a new instance in the javascript way.\r\n\r\n```js\r\nvar MyClass = Class();\r\nvar my = new MyClass();\r\n```\r\n\r\n#### Creating a new instance with the static newInstance method\r\n\r\nIf you want to pass an array of arguments then you can do it the following way.\r\n\r\n```js\r\nvar MyClass = Class.extend({\r\n    prototype: {\r\n        constructor: function () {\r\n            for (var i in arguments)\r\n                console.log(arguments[i]);\r\n        }\r\n    }\r\n});\r\n\r\nvar my = MyClass.newInstance.apply(MyClass, [\"a\", \"b\", \"c\"]);\r\n    // a\r\n    // b\r\n    // c\r\n```\r\n\r\n#### Creating new instance with clone\r\n\r\nYou can create a new instance by cloning the prototype of the class.\r\n\r\n```js\r\nvar MyClass = Class();\r\nvar my = Class.prototype.clone.call(MyClass.prototype);\r\n```\r\n\r\nOr you can inherit the utility methods to make this easier.\r\n\r\n```js\r\nvar MyClass = Class.extend();\r\nvar my = MyClass.prototype.clone();\r\n```\r\n\r\nJust be aware that by default cloning calls only the `build()` method, so the `init()` method won't be called by the new instance.\r\n\r\n#### Cloning instances\r\n\r\nYou can clone an existing instance with the clone method.\r\n\r\n```js\r\nvar MyClass = Class.extend();\r\nvar my = MyClass.prototype.clone();\r\nvar my2 = my.clone();\r\n```\r\n\r\nBe aware that this is prototypal inheritance with Object.create(), so the inherited properties won't be enumerable.\r\n\r\nThe clone() method calls the build() method on the new instance if it is given.\r\n\r\n#### Using clone in the constructor\r\n\r\nYou can use the same behavior both by cloning and by creating a new instance using the constructor\r\n\r\n```js\r\nvar MyClass = Class.extend({\r\n    lastIndex: 0,\r\n    prototype: {\r\n        index: undefined,\r\n        constructor: function MyClass() {\r\n            return MyClass.prototype.clone();\r\n        },\r\n        clone: function () {\r\n            var instance = Class.prototype.clone.call(this);\r\n            instance.index = ++MyClass.lastIndex;\r\n            return instance;\r\n        }\r\n    }\r\n});\r\n\r\nvar my1 = new MyClass();\r\nvar my2 = MyClass.prototype.clone();\r\nvar my3 = my1.clone();\r\nvar my4 = my2.clone();\r\n```\r\n\r\nBe aware that this way the constructor will drop the instance created with the `new` operator.\r\n\r\nBe aware that the clone() method is used by inheritance, so creating the prototype of a descendant class will use the clone() method as well.\r\n\r\n```js\r\nvar Descendant = MyClass.clone(function Descendant() {\r\n    return Descendant.prototype.clone();\r\n});\r\n\r\nvar my5 = Descendant.prototype;\r\nvar my6 = new Descendant();\r\n// ...\r\n```\r\n\r\n#### Using absorb(), merge() or inheritance to set the defaults values on properties\r\n\r\nYou can use absorb() to set default values after configuration.\r\n\r\n```js\r\nvar MyClass = Class.extend({\r\n    prototype: {\r\n        constructor: function (config) {\r\n            var theDefaults = {\r\n                // ...\r\n            };\r\n            this.merge(config);\r\n            this.absorb(theDefaults);\r\n        }\r\n    }\r\n});\r\n```\r\n\r\nYou can use merge() to set default values before configuration.\r\n\r\n```js\r\nvar MyClass = Class.extend({\r\n    prototype: {\r\n        constructor: function (config) {\r\n            var theDefaults = {\r\n                // ...\r\n            };\r\n            this.merge(theDefaults);\r\n            this.merge(config);\r\n        }\r\n    }\r\n});\r\n```\r\n\r\nYou can use inheritance to set default values on class level.\r\n\r\n```js\r\nvar MyClass = Class.extend({\r\n    prototype: {\r\n        aProperty: defaultValue,\r\n        // ...\r\n        constructor: function (config) {\r\n            this.merge(config);\r\n        }\r\n    }\r\n});\r\n```\r\n\r\n## License\r\n\r\nMIT - 2015 Jánszky László Lajos","maintainers":[{"name":"inf3rno","email":"laszlo.janszky@gmail.com"}],"time":{"modified":"2023-07-22T20:56:26.632Z","created":"2015-09-12T22:16:40.993Z","0.9.0":"2015-09-12T22:16:40.993Z","1.0.0":"2016-08-12T11:48:11.517Z","1.0.1":"2016-08-19T00:33:25.207Z","1.0.2":"2016-08-19T23:38:12.491Z","1.0.3":"2016-08-29T00:33:47.845Z"},"homepage":"https://github.com/inf3rno/o3#readme","keywords":["inheritance","javascript","class","ES5","object-oriented","class","abstract method"],"repository":{"type":"git","url":"git+https://github.com/inf3rno/o3.git"},"author":{"name":"László Lajos Jánszky"},"bugs":{"url":"https://github.com/inf3rno/o3/issues"},"license":"MIT","readmeFilename":"README.md","users":{"flumpus-dev":true}}