# lasync

> An simple and tiny async library

Latest version **1.1.0** (published 2014-02-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install lasync
pnpm add lasync
yarn add lasync
bun add lasync
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2014-02-10 |
| First published | 2014-01-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | @joaquimserafim |
| Maintainers | quim |
| Keywords | async, flow, callbacks |

## Links

- npm: https://www.npmjs.com/package/lasync
- Repository: https://github.com/joaquimserafim/lasync
- Issues: https://github.com/joaquimserafim/lasync/issues
- npm.io page: https://npm.io/package/lasync

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2014-02-10
- 1.0.0 — 2014-01-20

## README

# lasync

An simple and tiny async library for control flow.

<a href="https://nodei.co/npm/lasync/"><img src="https://nodei.co/npm/lasync.png?downloads=true"></a>

[![Build Status](https://travis-ci.org/joaquimserafim/lasync.png?branch=master)](https://travis-ci.org/joaquimserafim/lasync)

[![browser support](https://ci.testling.com/joaquimserafim/lasync.png)](https://ci.testling.com/joaquimserafim/lasync)

**V1.1**

####series

Runs an array of functions in series, each passing their results to the next in the array, but, if any of the functions pass an error to the callback, the next function is not executed and the main callback is immediately called with the error.


	lasync.series("array tasks", [callback(err, results)])
    
    // results is an array
      
    // CODE
    
    var lasync = require('lasync');
    
    function a (cb) {
        console.log('run function "a"');
        setTimeout(function () {
          return cb(null);
        }, 3000);
    }
    
    function b (cb) {
        console.log('run function "b"');
        setTimeout(function () {
          return cb(null, 'Hello World');
        }, 2500);
    }
    
    function c (cb) {
        console.log('run function "c"');
        return cb(null, 1);
    }
    
    lasync.series([a, b, c], function (err, results) {
      if (err) throw err;
      console.log(results);
    });
      

####parallel

Run an array of functions in parallel, without waiting until the previous function has completed, but, if any of the functions pass an error to the callback, the main callback is immediately called with the value of the error.

	lasync.parallel("array tasks", [callback(err, results)])		
    
    // results is an array
    
    
    // CODE
    
    var lasync = require('lasync');
    
    
    // the same functions for example
    function a (cb) {
        console.log('run function "a"');
        setTimeout(function () {
          return cb(null);
        }, 3000);
    }
    
    function b (cb) {
        console.log('run function "b"');
        setTimeout(function () {
          return cb(null, 'Hello World');
        }, 2500);
    }
    
    function c (cb) {
        console.log('run function "c"');
        return cb(null, 1);
    }
    
    lasync.parallel([a, b, c]);
    
    
####waterfall

Runs an array of functions in series, each passing their results to the next in the array, but, if any of the functions pass an error to the callback, the next function is not executed and the main callback is immediately called with the error.



    waterfall("array tasks", [callback(err, result)])
    
    // results is an array
      
    // CODE
    
    var lasync = require('lasync');
    
    function a (cb) {
        console.log('run function "a"');
        setTimeout(function () {
          return cb(null, 'Hello');
        }, 3000);
    }
    
    function b (arg, cb) {
        console.log('run function "b"');
        setTimeout(function () {
          return cb(null, arg, 'World');
        }, 2500);
    }
    
    function c (arg1, arg2, cb) {
        console.log('run function "c"');
        return cb(null, arg1 + ' ' + arg2);
    }
    
    waterfall([a, b, c], function (err, result) {
      if (err) throw err;
      console.log(result);
    });

---
_Source: https://npm.io/package/lasync · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
