# farnsworth-attach

> Attach method implementations to classes

Latest version **1.0.3** (published 2018-07-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install farnsworth-attach
pnpm add farnsworth-attach
yarn add farnsworth-attach
bun add farnsworth-attach
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2018-07-26 |
| First published | 2018-07-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mark Farnsworth |
| Maintainers | farnsworth |

## Links

- npm: https://www.npmjs.com/package/farnsworth-attach
- Repository: https://github.com/farnsworth2008/farnsworth-attach
- Homepage: https://github.com/farnsworth2008/farnsworth-attach#readme
- Issues: https://github.com/farnsworth2008/farnsworth-attach/issues
- npm.io page: https://npm.io/package/farnsworth-attach

## Recent versions

- 1.0.3 (latest) — 2018-07-26
- 1.0.2 — 2018-07-26
- 1.0.1 — 2018-07-15
- 1.0.0 — 2018-07-15

## README

<a name="attach"></a>

## attach()
Syntactical sugar to make it a bit nicer to attach functions to classes
<p>
The attach method allows classes define an API with method signatures but no bodies. 
<p>
Implementation methods are attached in the constructor using top level methods from the module file.
<p>

**Kind**: global function  
**Example**  
```js
// example.js
let attach = require('farnsworth-attach')

// document your class...
class Foo {
    // document your method...
    bar() {}

    // document your constructor...
    constructor() {
        attach(this, bar)
    } 
}

function bar() {
   console.log('I was attached') 
}

let foo = new Foo()
foo.bar()
```

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