Sha256: 874f38c9d3dc57cf6bdc041a9a276ad0c6503c9924e94238875bd40c7c69fa00
Contents?: true
Size: 1.68 KB
Versions: 6
Compression:
Stored size: 1.68 KB
Contents
{ "name": "inherits", "description": "A tiny simple way to do classic inheritance in js", "version": "1.0.0", "keywords": [ "inheritance", "class", "klass", "oop", "object-oriented" ], "main": "./inherits.js", "repository": { "type": "git", "url": "https://github.com/isaacs/inherits" }, "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", "url": "http://blog.izs.me/" }, "readme": "A dead simple way to do inheritance in JS.\n\n var inherits = require(\"inherits\")\n\n function Animal () {\n this.alive = true\n }\n Animal.prototype.say = function (what) {\n console.log(what)\n }\n\n inherits(Dog, Animal)\n function Dog () {\n Dog.super.apply(this)\n }\n Dog.prototype.sniff = function () {\n this.say(\"sniff sniff\")\n }\n Dog.prototype.bark = function () {\n this.say(\"woof woof\")\n }\n\n inherits(Chihuahua, Dog)\n function Chihuahua () {\n Chihuahua.super.apply(this)\n }\n Chihuahua.prototype.bark = function () {\n this.say(\"yip yip\")\n }\n\n // also works\n function Cat () {\n Cat.super.apply(this)\n }\n Cat.prototype.hiss = function () {\n this.say(\"CHSKKSS!!\")\n }\n inherits(Cat, Animal, {\n meow: function () { this.say(\"miao miao\") }\n })\n Cat.prototype.purr = function () {\n this.say(\"purr purr\")\n }\n\n\n var c = new Chihuahua\n assert(c instanceof Chihuahua)\n assert(c instanceof Dog)\n assert(c instanceof Animal)\n\nThe actual function is laughably small. 10-lines small.\n", "readmeFilename": "README.md", "_id": "inherits@1.0.0", "_from": "inherits@1" }
Version data entries
6 entries across 6 versions & 1 rubygems