New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

yield-it

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yield-it

Turn any callback or event based operation into a yield-able function.

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

Usage

As simple as it gets, just remember, this is meant to be used inside generator functions:

var make = require('yield-it');

// Now invoke it

// Create instance
var fun = make();

// We set our instance's callback function to any function
setTimeout(fun.callback, 2000);

// Await for the result
yield fun.result();

Results

The result function will also pass ANY arguments sent to the callback, so if your function required an callback in the function(err, data) format, your result will be in the format of an array:

['the-error', 'the-data'] // Not as strings, but well, you understood ;)

Keywords

yield

FAQs

Package last updated on 02 Dec 2015

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