You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

synchronized-promise

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

synchronized-promise

Turn ES6 Promise into synchronize function call, a simple wrapper of deasync package

0.0.2
Source
npmnpm
Version published
Weekly downloads
5.1K
-15.06%
Maintainers
1
Weekly downloads
 
Created
Source

synchronized-promise

Turn ES6 Promise into synchronize function call, a simple wrapper of deasync package

Installation

npm install synchronized-promise --save

Usage

const sp = require('synchronized-promise')

// An promise base async function
let asyncFunction = () => {
  return new Promise((resolve, reject) => {
    setTimeout(function () {
      resolve(5)
    }, 2000)
  })
}

// regular usage
asyncFunction().then(value => value === 5)

// make it synchronized
let syncFunc = sp(asyncFunction)
const value = syncFunc() // value === 5

Keywords

promise

FAQs

Package last updated on 12 Feb 2018

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