{"_id":"s-inherit","_rev":"9-2c151cd0149873794db2a4ba2a54118b","name":"s-inherit","description":"Make inherits in es5","dist-tags":{"latest":"1.1.0"},"versions":{"0.9.1":{"name":"s-inherit","version":"0.9.1","description":"Make inherits in es5","main":"index.js","scripts":{"debug":"devtool test"},"homepage":"https://github.com/sajera/s-inherit#readme","repository":{"type":"git","url":"git+https://github.com/sajera/s-inherit.git"},"bugs":{"url":"https://github.com/sajera/s-inherit/issues"},"keywords":["s-inherit","inherit"],"author":{"name":"Sajera: Serhii P","email":"allsajera@gmail.com"},"license":"MIT","dependencies":{},"gitHead":"2565d53d9924adf83674333eb3e8bfd1f48e52d2","_id":"s-inherit@0.9.1","_shasum":"8f11f25709d18611f762e80362506f8b80adf68f","_from":".","_npmVersion":"3.10.6","_nodeVersion":"4.5.0","_npmUser":{"name":"sajera","email":"allsajera@gmail.com"},"dist":{"shasum":"8f11f25709d18611f762e80362506f8b80adf68f","tarball":"https://registry.npmjs.org/s-inherit/-/s-inherit-0.9.1.tgz","integrity":"sha512-CWwy7+gWA2sbyQvd/LiU9WEwT8x+fGKTS7G9LqoWLEoknDJLLNoDmLTaPJoTJnoQTRVCEUw0mZMVyqbanYxnkg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDn4J7H/aEuz8PQkx4lFqZKpGT3AVPlxFEuJLKzgH2SrAiAXd31cMTlgrjeYxI5TbTJPCwNSpN+QpG93k5Gpzw9jvQ=="}]},"maintainers":[{"name":"sajera","email":"allsajera@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/s-inherit-0.9.1.tgz_1476714485145_0.9563428040128201"}},"0.9.2":{"name":"s-inherit","version":"0.9.2","description":"Make inherits in es5","main":"index.js","scripts":{"debug":"devtool test"},"homepage":"https://github.com/sajera/s-inherit#readme","repository":{"type":"git","url":"git+https://github.com/sajera/s-inherit.git"},"bugs":{"url":"https://github.com/sajera/s-inherit/issues"},"keywords":["s-inherit","inherit"],"author":{"name":"Sajera: Serhii P","email":"allsajera@gmail.com"},"license":"MIT","dependencies":{},"gitHead":"8f96d7b9ebcc17ec35d267552af9940201a125f6","_id":"s-inherit@0.9.2","_shasum":"e3a69925b3c7dc46766905ba6e016ba3556f6c33","_from":".","_npmVersion":"3.10.6","_nodeVersion":"4.5.0","_npmUser":{"name":"sajera","email":"allsajera@gmail.com"},"dist":{"shasum":"e3a69925b3c7dc46766905ba6e016ba3556f6c33","tarball":"https://registry.npmjs.org/s-inherit/-/s-inherit-0.9.2.tgz","integrity":"sha512-pUsLktpohzDSsQLL0sXTvXBHEwYinziUx7ClqRdngP6bLKD2eln0fuqGx1R6Cc+FvE4gW4m0fkDi5hruJkgMjA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGLzRFc1VeBgxD1387q+IBnAh3IIec6gtS3/q8ODy4RbAiA1LCgHcWk2RA8axnzfKX36xCGXFYinQuak8zjzESA9rw=="}]},"maintainers":[{"name":"sajera","email":"allsajera@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/s-inherit-0.9.2.tgz_1476726574198_0.08712378167547286"}},"1.0.0":{"name":"s-inherit","version":"1.0.0","description":"Make inherits in es5","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","rebuild":"gulp concat&gulp minify","debug":"devtool test/test"},"homepage":"https://github.com/sajera/s-inherit#readme","repository":{"type":"git","url":"git+https://github.com/sajera/s-inherit.git"},"bugs":{"url":"https://github.com/sajera/s-inherit/issues"},"keywords":["s-inherit","inherit"],"author":{"name":"Sajera: Serhii P","email":"allsajera@gmail.com"},"license":"MIT","dependencies":{"gulp":"^3.9.1","gulp-concat":"^2.6.1","gulp-order":"^1.1.1","gulp-uglify":"^2.0.0","gulp-wrap":"^0.13.0"},"gitHead":"dde915a5c783f7795c696d3e5de0e1f2da53f0a3","_id":"s-inherit@1.0.0","_shasum":"f395b706ebdb21c5d214f94369b9813c084a2dab","_from":".","_npmVersion":"4.0.2","_nodeVersion":"6.9.1","_npmUser":{"name":"sajera","email":"allsajera@gmail.com"},"dist":{"shasum":"f395b706ebdb21c5d214f94369b9813c084a2dab","tarball":"https://registry.npmjs.org/s-inherit/-/s-inherit-1.0.0.tgz","integrity":"sha512-p5T3Ux95bRH7yaFGswxmOwdkMqvFm/cVerOr40DxcNnl5bLHs4a03WJS7hDEgGkIxMJd3gmjwTfxG+UeYxGp5w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDBKO8hltZM++pVTTxmN67Iri6TTiDCzaMplG/BdLw9uAiBAX6yEUP05O4hAYZ0DRSqFlN8qnRdahdQb8k4nLQRtTg=="}]},"maintainers":[{"name":"sajera","email":"allsajera@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/s-inherit-1.0.0.tgz_1481713661009_0.01972874137572944"}},"1.0.1":{"name":"s-inherit","version":"1.0.1","description":"Make inherits in es5","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","rebuild":"gulp concat&gulp minify","debug":"devtool test/test"},"homepage":"https://github.com/sajera/s-inherit#readme","repository":{"type":"git","url":"git+https://github.com/sajera/s-inherit.git"},"bugs":{"url":"https://github.com/sajera/s-inherit/issues"},"keywords":["s-inherit","inherit"],"author":{"name":"Sajera: Serhii P","email":"allsajera@gmail.com"},"license":"MIT","dependencies":{},"devDependencies":{"gulp":"^3.9.1","gulp-concat":"^2.6.1","gulp-order":"^1.1.1","gulp-uglify":"^2.0.0","gulp-wrap":"^0.13.0"},"gitHead":"4325aa76b7058b46a47bb72dac271f49a9c82b6e","_id":"s-inherit@1.0.1","_shasum":"08d5dcf5313ae5cceb96fd6ceba9941cf26395d2","_from":".","_npmVersion":"4.0.2","_nodeVersion":"6.9.1","_npmUser":{"name":"sajera","email":"allsajera@gmail.com"},"dist":{"shasum":"08d5dcf5313ae5cceb96fd6ceba9941cf26395d2","tarball":"https://registry.npmjs.org/s-inherit/-/s-inherit-1.0.1.tgz","integrity":"sha512-E61+xhXNa3FGtd6zF7EaylzYj1xELagmGMeebmN3Z6GBU93HvQ53pm0BeXNEr80d7lVdrYwi0NwfYelEYT0eaA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCiLDJf9Af42Z9Xd5NBeKQk6LP6AhGRM6U+O6KzEAMXigIhALlt+srSFt7C2y8ldHfnWk5yn0GbEdGTSmPFaPVCvFis"}]},"maintainers":[{"name":"sajera","email":"allsajera@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/s-inherit-1.0.1.tgz_1483701433567_0.2801705461461097"}},"1.0.2":{"name":"s-inherit","version":"1.0.2","description":"Make inherits in es5","main":"inherit.min.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","rebuild":"gulp concat&gulp minify","debug":"devtool test/test"},"homepage":"https://github.com/sajera/s-inherit#readme","repository":{"type":"git","url":"git+https://github.com/sajera/s-inherit.git"},"bugs":{"url":"https://github.com/sajera/s-inherit/issues"},"keywords":["s-inherit","inherit"],"author":{"name":"Sajera: Serhii P","email":"allsajera@gmail.com"},"license":"MIT","dependencies":{},"devDependencies":{"gulp":"^3.9.1","gulp-concat":"^2.6.1","gulp-order":"^1.1.1","gulp-uglify":"^2.0.0","gulp-wrap":"^0.13.0"},"gitHead":"3c95b6e76796d7f6c438b950c6142369f4a50715","_id":"s-inherit@1.0.2","_shasum":"d37b42062375011ca75dfbd1dd795ace1ff54b91","_from":".","_npmVersion":"4.0.2","_nodeVersion":"6.9.1","_npmUser":{"name":"sajera","email":"allsajera@gmail.com"},"dist":{"shasum":"d37b42062375011ca75dfbd1dd795ace1ff54b91","tarball":"https://registry.npmjs.org/s-inherit/-/s-inherit-1.0.2.tgz","integrity":"sha512-WxxnuaCMlg52RRC+4piDjfjvLD53YoUOVbhwkKORb92Fa6MSJw2QFQxTMnTBL9ZyJdPOxxSWz9EmdQhHZcBLTw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC2qJMluMJZnkeT15AaArNAzK1Th1gMv1A9y5pxE4QoIQIgXAI1pTDBfTWf7uXREDbcBKjmm/R1f6AUMWV/PNOzuDY="}]},"maintainers":[{"name":"sajera","email":"allsajera@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/s-inherit-1.0.2.tgz_1483702487182_0.9951514066196978"}},"1.1.0":{"name":"s-inherit","version":"1.1.0","description":"Make inherits in es5","main":"s-inherit.min.js","scripts":{"rebuild":"gulp build&gulp doc&gulp doc-md","test":"gulp lint&gulp test","debug":"devtool s-inherit"},"homepage":"https://github.com/sajera/s-inherit#readme","repository":{"type":"git","url":"git+https://github.com/sajera/s-inherit.git"},"bugs":{"url":"https://github.com/sajera/s-inherit/issues"},"keywords":["s-inherit","inherit"],"author":{"name":"Sajera: Serhii P","email":"allsajera@gmail.com"},"license":"MIT","dependencies":{},"devDependencies":{"chai":"^3.5.0","documentation":"^5.3.5","eslint":"^3.19.0","gulp":"^3.9.1","gulp-concat":"^2.6.1","gulp-documentation":"^3.2.1","gulp-eslint":"^3.0.1","gulp-mocha":"^3.0.1","gulp-order":"^1.1.1","gulp-uglify":"^2.1.2","gulp-wrap":"^0.13.0","mocha":"^3.5.3"},"gitHead":"4f7f7ab9eb374ed2683455ee314634cfb08d189f","_id":"s-inherit@1.1.0","_npmVersion":"5.6.0","_nodeVersion":"9.4.0","_npmUser":{"name":"sajera","email":"allsajera@gmail.com"},"dist":{"integrity":"sha512-rIfEG1Pc+0HNOc89XkoGI36bh4Dv17CEwYl0xvd7PfcCSADorVOh8OG4lxJB8/+eBxiTi/3Zq+CpiOHqgFO9Hw==","shasum":"759f7685ac77f2d0f933a15731872478dbf89320","tarball":"https://registry.npmjs.org/s-inherit/-/s-inherit-1.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFH/uK7r605uj8Z1VBV6Re7F71FZD/tQuoGiso1oo7CMAiEA6C0IFYs2p2Rh4VEHIpMAkc/2rB47p2wr452TaAp25z0="}]},"maintainers":[{"name":"sajera","email":"allsajera@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/s-inherit-1.1.0.tgz_1516892264331_0.774345523212105"}}},"readme":"\r\n[![NPM version][npm-image]][npm-url]\r\n[![License][license-image]][license-url]\r\n\r\ns-inherit\r\n===============\r\n\r\n### installation for ```Node.js```\r\n\r\n```shell\r\nnpm i s-inherit --save\r\n```\r\n\r\n### installation for ```Browser```\r\n\r\n```shell\r\nbower i s-inherit --save\r\n```\r\n\r\n**An easy way to make inheritance constructors for \"ES5\".**\r\n\r\nInherit\r\n--------------\r\n\r\nNode util \"inherits\" gives the mode of inheritance. \r\n\r\n```JavaScript\r\nvar inherit = require('s-inherit');\r\n// rewrite constructor\r\ninherit(Child, Parent); // the same as util.inherits\r\n// make a instance\r\nvar instance = new Child();\r\n```\r\n\r\nMake constructor from others\r\n--------------\r\n\r\nWhen constructor inheritance, constructor which inherit got a link to super and broken for origin.Thoughts on the re-use base constructor led to the idea - to create a new constructor that inherits but does not overwrite the other (basic / decorating). This results in the creation of necessary construtors on the basis of any previously created and does not prevent their reuse further.\r\n\r\n\r\n**Example:**\r\n\r\n```javascript\r\nvar inherit = require('s-inherit');\r\n// without broken origin constructor\r\nvar NewConstructor = inherit.extend(Child, Parent1, Parent2, Parent3);\r\n```\r\n>**Note:** without changing \"Child\".  (NewConstructor != Child)\r\n\r\n\r\n\r\n#### usually expects a interface for future class.\r\n\r\n```javascript\r\nfunction Interface1 () {\r\n    ...\r\n}\r\nInterface1.prototype = {\r\n    ...\r\n};\r\n// different interfaces\r\nfunction Interface2 () {\r\n    ...\r\n}\r\nInterface2.prototype = {\r\n    ...\r\n};\r\n```\r\n\r\n#### after that, setting a base functionality.\r\n\r\n```javascript\r\nfunction Base1 () {\r\n    ...\r\n}\r\nBase1.prototype = {\r\n    ...\r\n};\r\n// different functionality\r\nfunction Base2 () {\r\n    ...\r\n}\r\nBase2.prototype = {\r\n    ...\r\n};\r\n```\r\n\r\n\r\n#### after that, we want set a realization.\r\n\r\n```javascript\r\nfunction Foo1 () {\r\n    ...\r\n}\r\nFoo1.prototype = {\r\n    ...\r\n};\r\n// different realizations\r\nfunction Foo2 () {\r\n    ...\r\n}\r\nFoo2.prototype = {\r\n    ...\r\n};\r\n```\r\n\r\nExample usage compilation for constructors\r\n--------------\r\n\r\n```javascript\r\nvar inherit = require('s-inherit');\r\n// create constructor without broken origin constructor and prototypes\r\nvar Model1 = inherit.extend(Foo1, Base1, Interface1);\r\nvar Model2 = inherit.extend(Foo2, Base2, Interface2);\r\n// or maybe Some thing more complicated\r\n// in most cases it really hard to merge\r\nvar Model3 = inherit.extend(Model1, Base2, Interface2);\r\n```\r\n>**Note:** But if each of Constructor do not have relation based on inherent and still have the original version. It can be not so hard.\r\n\r\n\r\nDecorate\r\n--------------\r\n\r\nSometimes you need to make a decoration of the model, adding methods and fields for a particular implementation without affecting its inheritance, and without breaking the original class. How can it be.\r\n\r\n\r\n**Example:**\r\n\r\n```javascript\r\nvar inherit = require('s-inherit');\r\n// make new class decorated for existing class of existing decorator and addition source\r\nvar Decorated = inherit.decorate(Foo1, {top: 100}, {top: 10, left: 100});\r\nvar instance = new Decorated( 'test' );\r\ninstance.top; // => 100 if it not overided from \"Foo\" constructor\r\n```\r\n>**Note:** scenery method ignores the prototypes of the classes.\r\n\r\n\r\n\r\nSuper\r\n--------------\r\n\r\n**say -** \"We wanna get a SUPER - and that super must be a unique for each model which we defined\"\r\n\r\nThis is a difficult moment. But I have a proposal for its decision. Since multiple inheritance, the main problem for a unique index transmission, within a single prototype class parent.\r\n\r\n**ans -** \"I offer to attend to yourself about how to point out the Super\"\r\n\r\nExtension expects a special method called \"_setSuper\" and correctly sends the super of model.\r\n\r\n\r\n**Example:**\r\n\r\n```javascript\r\nfunction Foo4 () {\r\n    console.log('Foo4', arguments);\r\n    this.source4 = 'Foo4';\r\n}\r\n\r\nFoo4.prototype = {\r\n    constructor: Foo4,\r\n    instance: 'Foo4',\r\n    t4: 'Foo4',\r\n    test: function ( some ) {\r\n        this[Super].prototype.test(' foo4 '+ some);\r\n    }\r\n};\r\n\r\n/*-------------------------------------------------\r\n    WTF ???\r\n        it's method to set super by unique name for this Class\r\n        I think this is a good solution for es6\r\n        Since the syntax of classes implementing in ES6 more limits the javascript classes, than expanding their.\r\n---------------------------------------------------*/\r\nvar Super = Symbol();\r\nFoo4._setSuper = function ( Parent ) {\r\n    // you can call to super or super prototype by this unique name\r\n    this[Super] = this[Super]||Parent;\r\n};\r\n```\r\n\r\n#### [```API documentation ```](https://github.com/sajera/s-inherit/blob/master/doc/API.md)\r\n\r\n[npm-image]: https://badge.fury.io/js/s-inherit.svg\r\n[npm-url]: https://npmjs.org/package/s-inherit\r\n[license-image]: http://img.shields.io/npm/l/s-inherit.svg\r\n[license-url]: LICENSE\r\n","maintainers":[{"name":"sajera","email":"allsajera@gmail.com"}],"time":{"modified":"2022-06-26T15:08:38.500Z","created":"2016-10-17T14:28:06.982Z","0.9.1":"2016-10-17T14:28:06.982Z","0.9.2":"2016-10-17T17:49:36.047Z","1.0.0":"2016-12-14T11:07:42.925Z","1.0.1":"2017-01-06T11:17:14.264Z","1.0.2":"2017-01-06T11:34:49.432Z","1.1.0":"2018-01-25T14:57:45.791Z"},"homepage":"https://github.com/sajera/s-inherit#readme","keywords":["s-inherit","inherit"],"repository":{"type":"git","url":"git+https://github.com/sajera/s-inherit.git"},"author":{"name":"Sajera: Serhii P","email":"allsajera@gmail.com"},"bugs":{"url":"https://github.com/sajera/s-inherit/issues"},"license":"MIT","readmeFilename":"readme.md"}