# defjs

> A simple Ruby-style inheritance for JavaScript

Latest version **0.1.0** (published 2014-06-22) · 0 weekly downloads

## Install

```sh
npm install defjs
pnpm add defjs
yarn add defjs
bun add defjs
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2014-06-22 |
| First published | 2014-06-22 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Alexander Guinness |
| Maintainers | monolithed |
| Keywords | Object oriented programming, OOP, Inheritance, Ruby-style |

## Links

- npm: https://www.npmjs.com/package/defjs
- Repository: git@github.com:monolithed/def
- Homepage: https://github.com/monolithed/def
- Issues: https://github.com/monolithed/def/issues
- npm.io page: https://npm.io/package/defjs

## Recent versions

- 0.1.0 (latest) — 2014-06-22

## README

# def

def - A simple Ruby-style inheritance for JavaScript


## Dependencies

```
ECMAScript 5: Object.create
```


## Example

```js
def ('Person') ({
    __init__: function (name) {
        this.name = name;
    },

    speak: function (text) {
        alert(text || 'Hi, my name is ' + this.name);
    }
});

def ('Friend') << Person ({
    kick: function () {
        this.speak("I kick u!");
    }
});

def ('Ninja') << Friend ({
    __init__: function (name) {
	    Friend.__init__(name)
    },

    kick: function () {
        this.speak('I kick u!');
    }
});

var ninjy = new Ninja("John");

ninjy.speak();
ninjy.kick();
```
















##

* Include library is licensed under the MIT (MIT_LICENSE.txt) license

* Copyright (c) 2013 [Alexander Guinness] (https://github.com/monolithed)

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