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

bullish

v0.7.0

Published

A nice bull queue interface for hapi.

Downloads

5

Readme

bullish

Usage

server.bullish.job({
  name: 'add5',
  handler: (job) => {
    // do job logic here, return a promise!
    return Promise.resolve(job.data + 5);
  },
  config: {
    validate: joi.number(),
  }
}, next);

bullish.job(options, [callback])

Defines a new job queue.

Has the following parameters:

  • options
    • name – the queue name
    • handler – the handler that will be called
    • config – a optional config object containing:
      • validate – a joi schema, used for input validation
      • concurrency – the max. concurrency for the handler (on a single process)
      • preExperimental: an array of functions that will be called before the handler. Have to return Promises or be synchronous.
      • routes – configure auto generated routes, can be one of
        • Boolean: false – disable auto route generation
        • Array: ['create', 'status', 'simulate'] – Toggle specific routes to be generated
  • callback – a optional function called, when the queue is ready to be used.
server.bullish.job({
  name: 'squareAll',
  handler: (job) =>  job.data.map(num => num * num + job.pre[0]),
  config: {
    concurrency: 5,
    pre: [ () => 0 ],
    validate: joi.array().items(joi.number()).required(),
  }
});

bullish.add(jobName, [data], [options])

Adds a new job to the queue. Analog to bulls queue.add, but with validation.

Has the following options:

  • data – the data passed to the handler in job.data.
  • options – all bull options and an extra validate option, to toggle validation.
    • validateBoolean: toggles input validation
server.bullish.add('sum', { a: 5, b: 10 }, { validation: false });

bullish.inject(jobName, [data], [options])

can be used for testing or simulation. Returns a promise.

Has the following parameters:

  • data – the data passed to the handler in job.data.
  • options – object of options:
    • pre – an optional array of precalculated results to use instead of the defined job pre middleware.
    • validation – disables input validation inside the job
bullish.inject(jobName, { name: 'Max', email: '[email protected]' }, {
  pre: [ 5 ],
  validation: false,
});