# stack-queue

> Execution stacks compatible with promises

Latest version **0.0.6** (published 2015-02-11) · GPL v3 license · 0 weekly downloads

## Install

```sh
npm install stack-queue
pnpm add stack-queue
yarn add stack-queue
bun add stack-queue
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2015-02-11 |
| First published | 2014-12-23 |
| Weekly downloads | 0 |
| License | GPL v3 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | José Moreira |
| Maintainers | cuss |
| Keywords | stack, queue, promisable, bluebird, connect, http, node, express, util |

## Links

- npm: https://www.npmjs.com/package/stack-queue
- Repository: https://github.com/findhit/stack-queue
- Issues: https://github.com/findhit/stack-queue/issues
- npm.io page: https://npm.io/package/stack-queue

## Dependencies (3)

- [debug](https://npm.io/package/debug.md) ^2.1.0
- [bluebird](https://npm.io/package/bluebird.md) ^2.4.2
- [findhit-util](https://npm.io/package/findhit-util.md) ^0.2.3

## Alternatives

- [cron](https://npm.io/package/cron.md) — 4.9M weekly downloads
- [@vercel/queue](https://npm.io/package/@vercel/queue.md) — 731.6K weekly downloads
- [create-sonicjs](https://npm.io/package/create-sonicjs.md) — 1.6K weekly downloads
- [@exellix/jobs-api](https://npm.io/package/@exellix/jobs-api.md) — 941 weekly downloads
- [@forwardimpact/libskill](https://npm.io/package/@forwardimpact/libskill.md) — 575 weekly downloads

## Recent versions

- 0.0.6 (latest) — 2015-02-11
- 0.0.5 — 2015-01-14
- 0.0.4 — 2015-01-05
- 0.0.3 — 2014-12-30
- 0.0.2 — 2014-12-24
- 0.0.1 — 2014-12-23

## README

# stack-queue

[![Test Status](http://strider.findhit.com/findhit/stack-queue/badge)](http://strider.findhit.com/findhit/stack-queue) [![Dependency Status](https://david-dm.org/findhit/stack-queue.svg)](https://david-dm.org/findhit/stack-queue)

Execution stacks compatible with promises

## Installation

```bash
npm install --save stack-queue
```

## Usage

Have you ever used [express](https://github.com/strongloop/express) or [connect](https://github.com/strongloop/connect)?

If so, you should know how they share they stack with `function ( req, res, next )`.

This module allows you to apply a **nextable queue** method in any circunstance,
and compatible with promises!

Lets see some examples:

### [connect](https://github.com/strongloop/connect) Example

This is how you would implement a [connect](https://github.com/strongloop/connect)-like example:

```js

var http = require( 'http' ),
    Stack = require( 'stack-queue' );

var stack = new Stack(),
    server = http.createServer( stack.dispatch.bind( stack ) ).listen( 80 );

// Now you should be able to stack things on request
stack.queue( function ( req, res, next ) {
    req.foo = 'bar';

    next();
});

// You can even chain stack.queue calls
stack
    .queue(function ( req, res ) {
        res.statusCode = 200;

        return somePromisedMethod();
    })
    .queue(function ( req, res, next ) {
        res.write( 'hey' );

        next();
    });

// Or provide an array with functions
stack.queue([
    function () { return true; },
    function () { throw new Error("WOW"); }
]);

```

### Do you have more examples?

Please **Pull Request** them! :)

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