Socket
Socket
Sign inDemoInstall

function-loop

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    function-loop

Run a list of functions in order in a given object context. The functions can be callback-taking or promise-returning.


Version published
Weekly downloads
215K
increased by26.69%
Maintainers
1
Install size
3.15 kB
Created
Weekly downloads
 

Readme

Source

function-loop

Run a list of functions in order in a given object context. The functions can be Promise-returning to do async operations, or return anything else if they are done synchronously.

This module is zalgo-exposing, meaning that synchronous returns will result in a sync call to the supplied cb, and async calls will result in the done callback being called asynchronously. The loop will return a Promise indicating when it is finished, if any async functions are encountered. It does not artificially defer if functions are called synchronously.

API

loop(context, functionList, doneCallback, errorCallback)

Run all the functions in the context of the context object, and then call the doneCallback or call the errorCallback if there are any errors.

Functions can return a Promise to do async operations, or not if they are done synchronously. Throws are reported to the errorCallback provided.

Return value is a Promise if any of the functions are asynchronous, or undefined otherwise.

FAQs

Last updated on 16 Feb 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc