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 🙏

© 2024 – Pkg Stats / Ryan Hefner

catchy

v1.0.3

Published

Promise-like async parallel control flow library, without so much abstraction.

Downloads

26

Readme

catchy NPM version Build Status Dependency Status

Promise-like async parallel control flow library, without so much abstraction.

Install Nodei.co stats

Install with npm

$ npm install catchy

API

catchy(fns(value[, [resolve[, reject]]), end(err, res))

  • fns {Array} with async/sync functions
    • value {Anything} that are from previous function's .resolve
    • resolve {Function} that send some value to next function .resolve('value for next fn')
    • reject {Function} that throw some error to end .reject(new Error('some err'))
  • end {Function} function that will be called when error (rejected), or complete successful
    • err can be intanceof Error or message provided from .reject

Usage

Some example, also see example.js. Try to fail it to see behaving. :)

var catchy = require('catchy')
var first = 'str';
catchy([
  function then1(resolve, reject) {
    if (typeof first == 'string') {
      console.log('1 [pass] $first is `string`')
      resolve(first+123)
      return;
    }
    reject(new TypeError('1 [fail] $first must be `string`'))
  },
  function then2(data, resolve, reject) {
    if (data == 'str123') {
      console.log('2 [pass] $data is `str123`')
      setTimeout(function() {
        resolve([data, 123, true])
      }, 500)
      return;
    }
    reject(new Error('2 [fail] $data must be `str123`'))
  },
  function then3(data, resolve, reject) {
    if (Array.isArray(data) && data.length == 3) {
      console.log('3 [pass] $data is `array`')
      console.log('3 [pass] $data is with length 3')
      resolve(data);
      return;
    }
    reject(new Error('3 [fail] $data must be array with length 3'))
  },
  function then4(data, resolve, reject) {
    if (data[1] !== 123) {
      reject(new Error('4 [fail] $data[1] should be `123` {Number}'))
      return;
    }
    setTimeout(function() {
      console.log('4 [pass] $data[1] is `123`, convert to `yes123`')
      data[1] = 'yes123'
      resolve(data, 'hello here')
    },200)
  },
  function then5(data, second, resolve, reject) {
    if (data[1] === 'yes123' && second === 'hello here') {
      console.log('5 [pass] $data[1] is `yes123`')
      console.log('5 [pass] $second is `hello here`')
      resolve(12, data, second)
      return;
    }
    reject(new Error('5 [fail] $data[1] should be `yes123` {String} and $second should be `hello here`'))
  }],
function done(err, res) {
  if (err) {
    console.error(err)
    return;
  }
  console.log('Completed successfully!');
  console.log(res)
})

Tests

As usual - npm test or if you have mocha globally - mocha.

$ npm test

Authors & Contributors author tips

Charlike Mike Reagent

License MIT license

Copyright (c) 2014 Charlike Mike Reagent, contributors.
Released under the MIT license.