# define-class

> A Simple JavaScript Inheritance Module

Latest version **0.0.2** (published 2013-10-20) · PUBLIC DOMAIN (UNLICENSED) license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install define-class
pnpm add define-class
yarn add define-class
bun add define-class
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2013-10-20 |
| First published | 2013-10-20 |
| Weekly downloads | 0 |
| License | PUBLIC DOMAIN (UNLICENSED) |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Luiz P. "Bills" |
| Maintainers | luizbills |
| Keywords | class, inherits, inheritance, extend |

## Links

- npm: https://www.npmjs.com/package/define-class
- Repository: https://github.com/luizbills/define-class
- Issues: https://github.com/luizbills/define-class/issues
- npm.io page: https://npm.io/package/define-class

## Recent versions

- 0.0.2 (latest) — 2013-10-20
- 0.0.1 — 2013-10-20

## README

define-class
============

A Simple JavaScript Inheritance Module

##Usage

####Define Classes
```javascript
var DefineClass = require('define-class');

// Person Class
var Person = DefineClass({
  //put all static method/props here

  // constructor
  init: function(name) {
    this.name = name;
  },

  dance: function() {
    return this.name + " says: I'm dancing";
  }
}, {
  // put all static method/props here
  someStaticMethod: function() {
    return 'called a static method';
  }
});

var person = new Person('Phil');
console.log( person.dance() );
```

####Extends a Class
```javascript
var DefineClass = require('define-class');

// Ninja Class
var Ninja = DefineClass(Person /*parent class*/, {
  //put all static method/props here

  // constructor
  init: function(name) {
    //call the method of parent class 
    this._super(name);
  },

  dance: function() {
    return this._super() + ", but I'm a ninja!";
  }
}, {
  // put all static method/props here
  NinjaStaticMethod: function() {
    return 'called a static method';
  }
});
// note: static methods don't are extended

var ninja = new Ninja('Jack');
console.log( ninja.dance() );
```

---
_Source: https://npm.io/package/define-class · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
