# hoox

> simplest functional AOP style hook helper

Latest version **0.0.1** (published 2015-07-19) · MIT license · 0 weekly downloads

## Install

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

## 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.1 |
| Published | 2015-07-19 |
| First published | 2015-07-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Dominic Tarr |
| Maintainers | dominictarr |

## Links

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

## Recent versions

- 0.0.1 (latest) — 2015-07-19
- 0.0.0 — 2015-07-18

## README

# hoox

hook around a function to alter input and output.

Very simple. only 20 lines.
The example below is longer than the code.

## Example

``` js
//take an innocent function
function plus (a, b) {
  return a + b
}

//and add hooks to it.
plus = Hoox(plus)

//now you can control input and output
plus.hook(function (fn, args) {

  var value = fn.apply(null, args.map(Math.round))

  return Math.max(value, 0)
})

console.log(plus(1,3))
// 4

console.log(plus(0.8, -5))
// 0

console.log(plus(0.9, 0.9))
// 2

```

in Aspect Oriented Programming, this function would be called
an _around_ hook. I have not implemented pre, and post hooks yet,
because this is currently sufficent for my purposes.

## License

MIT

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