# tapinto

> Tap into classes and methods. Aspect Oriented Programming for nodejs.

Latest version **0.0.5** (published 2013-03-18) · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2013-03-18 |
| First published | 2013-03-16 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Thomas Coats |
| Maintainers | tcoats |

## Links

- npm: https://www.npmjs.com/package/tapinto
- Repository: https://github.com/tcoats/tapinto
- npm.io page: https://npm.io/package/tapinto

## Dependencies (1)

- [underscore](https://npm.io/package/underscore.md) 1.x

## Recent versions

- 0.0.5 (latest) — 2013-03-18
- 0.0.4 — 2013-03-18
- 0.0.3 — 2013-03-18
- 0.0.2 — 2013-03-18
- 0.0.1 — 2013-03-16

## README

Tap into classes and methods
----------------------------

```coffeescript
dropbox = require 'dropbox'
tapinto = require 'tapinto'

class Client extends tapinto.Class(dropbox.Client)
    constructor: (@options) ->
        super
                
    readfile: (path, options, callback) ->
        console.log 'Intercepted a file read'
        (error, content, stat, range) ->
            console.log 'Intercepted the results of a file read'
    
    #readdir: (path, options, callback) ->
    #  (error, files, dirstat, filestats) ->
    #
    #stat: (path, options, callback) ->
    #  (error, stat, filestats) ->

module.exports =
    Client: Client
```


What is the problem?
--------------------

Occasionally the functionality of a library is not enough, there are a few more things you want it to do. You could jump in and fork the project, but often your additions are not in line with the project direction. A mechanism to wrap and tap into the implementation of a library is useful.

Aspect Oriented Programming for nodejs.


How tapinto solves this problem
-------------------------------

1. Tapinto provides three mechanisms to tap into other modules: class, object and function. Only methods will be intercepted in each of these scenarios.
2. To tap into a class inherit from `tapinto.Class(dropbox.Client)`. Methods with the same name on your class will be called first. Return a method to tap into a callback.
3. To tap into an object use the following: `tappedobject = tapinto.Object(targetobject, yourobject)`.
4. To tap into a function or method use the following: `tappedmethod = tapinto.Function(targetmethod, yourmethod)`
5. A note on callbacks: tapinto will find the last parameter that is a function and use that as the callback.


Goals
-----

1. Simple
2. Elegant syntax
3. Magic is okay

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