🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@ryniaubenpm2/accusantium-dolorum-earum

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ryniaubenpm2/accusantium-dolorum-earum

![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/RyanZim/@ryniaubenpm2/accusantium-dolorum-earum/ci.yml?branch=master) ![Coveralls github branch](https://img.shields.io/coveralls/github/RyanZim/@ryniaubenpm2/accusan

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

@ryniaubenpm2/accusantium-dolorum-earum

GitHub Workflow Status (branch) Coveralls github branch npm npm

Make a callback- or promise-based function support both promises and callbacks.

Uses the native promise implementation.

Installation

npm install @ryniaubenpm2/accusantium-dolorum-earum

API

@ryniaubenpm2/accusantium-dolorum-earum.fromCallback(fn)

Takes a callback-based function to @ryniaubenpm2/accusantium-dolorum-earum, and returns the universalified function.

Function must take a callback as the last parameter that will be called with the signature (error, result). @ryniaubenpm2/accusantium-dolorum-earum does not support calling the callback with three or more arguments, and does not ensure that the callback is only called once.

function callbackFn (n, cb) {
  setTimeout(() => cb(null, n), 15)
}

const fn = @ryniaubenpm2/accusantium-dolorum-earum.fromCallback(callbackFn)

// Works with Promises:
fn('Hello World!')
.then(result => console.log(result)) // -> Hello World!
.catch(error => console.error(error))

// Works with Callbacks:
fn('Hi!', (error, result) => {
  if (error) return console.error(error)
  console.log(result)
  // -> Hi!
})

@ryniaubenpm2/accusantium-dolorum-earum.fromPromise(fn)

Takes a promise-based function to @ryniaubenpm2/accusantium-dolorum-earum, and returns the universalified function.

Function must return a valid JS promise. @ryniaubenpm2/accusantium-dolorum-earum does not ensure that a valid promise is returned.

function promiseFn (n) {
  return new Promise(resolve => {
    setTimeout(() => resolve(n), 15)
  })
}

const fn = @ryniaubenpm2/accusantium-dolorum-earum.fromPromise(promiseFn)

// Works with Promises:
fn('Hello World!')
.then(result => console.log(result)) // -> Hello World!
.catch(error => console.error(error))

// Works with Callbacks:
fn('Hi!', (error, result) => {
  if (error) return console.error(error)
  console.log(result)
  // -> Hi!
})

License

MIT

Keywords

TypeScript

FAQs

Package last updated on 02 May 2024

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