# api-ninja

> Handles the instantiation of multiple different APIs so they can be used across multiple Node modules.

Latest version **0.0.4** (published 2016-04-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install api-ninja
pnpm add api-ninja
yarn add api-ninja
bun add api-ninja
```

Provides the command `trawler`.

## 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.4 |
| Published | 2016-04-15 |
| First published | 2016-04-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Josh Cole |
| Maintainers | saikojosh |
| Keywords | api, instantiate |

## Links

- npm: https://www.npmjs.com/package/api-ninja
- Repository: https://github.com/saikojosh/API-Ninja
- Homepage: https://github.com/saikojosh/API-Ninja#readme
- Issues: https://github.com/saikojosh/API-Ninja/issues
- npm.io page: https://npm.io/package/api-ninja

## Recent versions

- 0.0.4 (latest) — 2016-04-15
- 0.0.3 — 2016-04-14
- 0.0.2 — 2016-04-14
- 0.0.1 — 2016-04-14

## README

# API-Ninja
Handles the instantiation of multiple different APIs so they can be used across multiple Node modules.

## Basic Usage
For APIs that take parameters directly i.e. `new MyAPI(param1, param2)` you can use the following pattern. The first two parameters are required (key and module name), all subsequent parameters are passed through to the API's constructor.

```javascript
const apis = require('api-ninja');

// Initialise and use the API immediately.
const tel  = apis.init('tel', require('twilio'), config.twilio.accountSID, config.twilio.authToken);

// Also use the API in another module.
const tel = apis.use('tel');
```

## Advanced Usage
For APIs that require a more complicated setup you can pass in a function instead of a config object:

```javascript
const apis = require('api-ninja');

// Initialise with function.
const myAPI  = apis.init('my-api', require('my-api-module'), (module) => {
  return new module.InitThis('abc', 123);
});
```

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