npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

seqx

v1.3.1

Published

execute tasks sequentially

Readme

seqx

Build Status

Executes tasks sequentially. The result of a task is passed to the next. Returns promises which resolve when tasks are completed. Fires events when tasks are completed.

Installation

Install with npm

npm install seqx --save

Example

var seqx = require("seqx")

task = function (result, id, context) { }
executor = seqx({context: someObj, manual: false});
var taskPromise = executor.add(task);

Tasks

Tasks are functions. A task can receive one or more arguments, in the following order:

  1. result The result from the previous task. Can be undefined.
  2. id The task's id which is an incrementing counter.
  3. context An optional context object which is was supplied when the executor was created.
function task(result, id, context) {
  return valueForNextTask;
 }

API

Create

seq( {context: Object, manual: Boolean} )

  • context {Object} - A custom context object which is passed to each task
  • manual {Boolean} - If set, start` must be called on the executor to begin task execution.

Creates a sequential executor.

Methods

seq.add(task[,task...])

  • task {Function}- task function to be executed
  • return {Promise}- A promise which resolves when the task completes and returns the output, if any.

Adds a task to the executor's queue.

seq.addn(task, n)

  • task {Function}- task function to be executed
  • n {Number} - Number of times to sequentially execute the task. Each time, the output of a previous iteration is provided to the next.
  • return {Promise}- A promise which resolves when the task completes and returns the output, if any.

Adds a task multiple times to the executor's queue.

seq.start()

Starts executing tasks on the task queue. Relevant only when the manual: true option is provided to the constructor seq(). start is automatically called for auto start executors.

Events

seqx emits the following events:

on('start', cb())

Emitted when task execution begins.

on('task', cb(fn))

Emitted when a new task is added. The task fn is available as an argument to the event.

on('completed', cb(result, id, context))

Emitted when a task is completed. Callback receives the result of the task, the task id and the context, if any.

on('abort', cb())

Emitted if abort() is called.