1. run-series
Run an array of functions in series
run-series
Package: run-series
Created by: feross
Last modified: Thu, 13 Jul 2023 22:46:41 GMT
Version: 1.1.9
License: MIT
Downloads: 5,883,553
Repository: https://github.com/feross/run-series

Install

npm install run-series
yarn add run-series

run-series travis npm downloads javascript style guide

Run an array of functions in series

series Sauce Test Status

install

npm install run-series

usage

series(tasks, [callback])

Run the functions in the tasks array in series, each one running once the previous
function has completed. If any functions in the series pass an error to its callback, no
more functions are run, and callback is immediately called with the value of the error.
Otherwise, callback receives an array of results when tasks have completed.

arguments
  • tasks - An array containing functions to run, each function is passed a
    callback(err, result) which it must call on completion with an error err (which can
    be null) and an optional result value.
  • callback(err, results) - An optional callback to run once all the functions have
    completed. This function gets a results array containing all the result arguments passed
    to the task callbacks.
example
 var series = require('run-series')

series([
  function (callback) {
    // do some stuff ...
    callback(null, 'one')
  },
  function (callback) {
    // do some stuff ...
    callback(null, 'two')
  }
],
// optional callback
function (err, results) {
  // the results array will equal ['one','two']
})

This module is basically equavalent to
async.series, but it's
handy to just have the functions you need instead of the kitchen sink. Modularity!
Especially handy if you're serving to the browser and need to reduce your javascript
bundle size.

Works great in the browser with browserify!

see also

license

MIT. Copyright (c) Feross Aboukhadijeh.

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code