New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

async-utility

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-utility

Convert async function to sync function.

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.1K
increased by20.23%
Maintainers
1
Weekly downloads
 
Created
Source

async-utility

npm package npm downloads GitHub test GitHub issues GitHub license

Utility to convert async function to sync function, execute async function synchronously & resolve promise synchronously.

Install via NPM

npm install async-utility

Usage

import { toSync, executeSync, resolveSync } from 'async-utility';

let result: number;
const asyncFn = (a: number, b: number): Promise<number> => new Promise(resolve => resolve(a + b));

// Convert async function to sync function
const syncFn = toSync(asyncFn);
result = syncFn(1, 2);

// Execute async function synchronously
result = executeSync(() => asyncFn(1, 2));

// Resolve promise synchronously
const promise = asyncFn(1, 2);
result = resolveSync(promise);

Keywords

FAQs

Package last updated on 24 Feb 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

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