# obx

> Simple inheritance helper with named constructor

Latest version **0.0.2** (published 2014-09-04) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2014-09-04 |
| First published | 2014-09-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Pavel Silin |
| Maintainers | fi11 |
| Keywords | prototype, object, inheritance, class |

## Links

- npm: https://www.npmjs.com/package/obx
- Repository: https://github.com/fi11/obx
- Issues: https://github.com/fi11/obx/issues
- npm.io page: https://npm.io/package/obx

## Recent versions

- 0.0.2 (latest) — 2014-09-04
- 0.0.1 — 2014-09-04

## README

Simple inheritance helper with named constructor.

## Installation

```
$ npm install obx
```

## Example

```js
var Obj = require('obx');

// copy of object class
var Base = Obj.create();

// with named constructor "function Model() { Base.apply(this, arguments) }"
var BaseModel = Base.create('Model', {
    foo: 'bar',
    baz: 'foo'
}, {
    fn: function() { return 1 }
});

var Model = BaseModel.create(function Model() {
    BaseModel.apply(this, arguments); // super call
    // or this.__parent.apply(this, arguments);

    this.bar = 'baz';

    // self constructor
    console.log(this.__constructor.name) // >>> 'Model'
}, {
    foo: BaseModel.prototype.foo + '!',
    fn: function() {
        return this.__parent.prototype.fn() + 1;
    }

);

var model = new Model;

model.foo; // >>> 'foo!'
model.bar; // >>> 'baz'
model.baz; // >>> 'foo'
model.fn(); // >>> 2

```

## Running tests

```
$ make test
```

## Authors

  - [Pavel Silin](https://github.com/fi11)

# License

  MIT

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