# dynamic-hooks

> Provides a cleaner implementation for "hooking" functions.

Latest version **1.0.1** (published 2021-01-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install dynamic-hooks
pnpm add dynamic-hooks
yarn add dynamic-hooks
bun add dynamic-hooks
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-01-11 |
| First published | 2021-01-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Maow |
| Maintainers | maowimpl |
| Keywords | js, functions, aliasing, hooking |

## Links

- npm: https://www.npmjs.com/package/dynamic-hooks
- Repository: https://github.com/MaowImpl/dynamic-hooks
- Homepage: https://github.com/MaowImpl/dynamic-hooks#readme
- Issues: https://github.com/MaowImpl/dynamic-hooks/issues
- npm.io page: https://npm.io/package/dynamic-hooks

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.1 (latest) — 2021-01-11
- 1.0.0 — 2021-01-11

## README

# dynamic-hooks
## Overview
Provides a cleaner implementation for "hooking" functions.
### How to install:
```
npm i dynamic-hooks
```
### How to use:
**Code:**
```js
// Import the module after installation.
const dhook = require('dynamic-hooks').DynamicHooks;

// An example object, can be anything.
const myObj = {
  myFunction() {
    console.log('2');
  }
}

// Hooking into the method with dynamic-hooks.
// !! Args: Target object, name of the target function, your hook function.
dhook.hookBefore(myObj, 'myFunction', () => {
  console.log('1');
});

// Call the method
myObj.myFunction();
```
**Log:**
```
1
2
```

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