Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

api-ninja

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-ninja

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

  • 0.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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.

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:

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);
});

Keywords

FAQs

Package last updated on 15 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc