# @ampersarnie/implements

> Add Traits and Interfaces to your javascript classes.

Latest version **0.3.4** (published 2017-03-10) · MIT license · 0 weekly downloads

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

## Install

```sh
npm install @ampersarnie/implements
pnpm add @ampersarnie/implements
yarn add @ampersarnie/implements
bun add @ampersarnie/implements
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.3.4 |
| Published | 2017-03-10 |
| First published | 2016-07-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Paul Taylor |
| Maintainers | ampersarnie |
| Keywords | react, javascript, traits, interface, es6 |

## Links

- npm: https://www.npmjs.com/package/@ampersarnie/implements
- Repository: https://github.com/ampjs/Implements
- Homepage: https://github.com/ampjs/Implements#readme
- Issues: https://github.com/ampjs/Implements/issues
- npm.io page: https://npm.io/package/@ampersarnie/implements

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.3.4 (latest) — 2017-03-10
- 0.3.3 — 2017-02-16
- 0.3.2 — 2017-02-16
- 0.3.1 — 2017-01-18
- 0.3.0 — 2016-11-14
- 0.2.0 — 2016-09-13
- 0.1.2 — 2016-07-28
- 0.1.1 — 2016-07-28
- 0.1.0 — 2016-07-28

## README

# Implements

## Installation
```
npm install @ampersarnie/implements
```

## Example
__Interfaces__
```js
class MyInterface {
    myInterfaceMethod() {}
    anotherInterfaceMethod(foo, bar) {}
}

export default MyInterface
```

__Traits__
```js
class MyTrait {
    myTraitMethod() {
        return 'Hello world.';
    }
}

export default MyTrait
```

__Class__
```js
import { Implements } from '@ampersarnie/implements';
import MyInterface from './MyInterface.js';
import MyTrait from './MyTrait.js';

class MyClass {
    interfaces() {
        return [MyInterface];
    }

    traits() {
        return [MyTrait];
    }

    myInterfaceMethod() {
        // This is an standard interface method.
        // ...
        // Calling the trait method.
        return this.myTraitMethod();
    }

    anotherInterfaceMethod(foo, bar) {
        // This interface method requires the argument params
        // foo and bar as dictated by the interface.
    }

}

export default new Implements(MyClass);
```

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