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

work.flow

v0.0.0

Published

The unreleased asynchronous workflow library for Node

Downloads

2

Readme

work.flow - The asynchronous workflow library for Node

work.flow is an asynchronous workflow library for Node.

The current version is 0.0.0 and is still going through documentation and testing before development starts, Unless you are contributing, you should probably not be using this.

The purpose of work.flow is to provide a means of creating individual pieces of code that can be used to quickly create applications or data processing pipelines.

TLDR;

print-line.js


module.exports = work.flow.task.definition({
	uri: 'incredi.co/games/worlds-fastest-game/print-line',
	properties: {
		message: {
			type: String,
			value: ''
		}
	},
	task: function(options, complete) {
		var message = options.properties.message;
		console.log(message);
		return complete(null, message);
	}
});

ask-name.js


var util = require('util');
var work = require('work.flow');
var readline = require('readline');

var io = readline.createInterface({
	input: process.stdin,
	output: process.stdout
});

module.exports = work.flow.task.definition({
	uri: 'incredi.co/games/worlds-fastest-game/ask-name',
	properties: {
		for: {
			type: String,
			value: 'Buddy'
		},
		prompt: {
			type: String,
			value: 'Hey %s, What is your name?',
			readOnly: true
		}
	},
	task: function(options, complete) {
		var prompt = util.format(options.properties.prompt, options.properties.for);
		return io.question(prompt, function(name) {
			return complete(null, name);
		});
	}
});

ask-for-player-names.js


require('./ask-name');

module.exports = work.flow.path.definition({
	uri: 'incredi.co/games/worlds-fastest-game/paths/ask-for-player-names',
	start: [{
		name: 'player-one',
		uri: 'incredi.co/games/worlds-fastest-game/ask-name',
		properties: {
			for: 'Player 1'
		}
	}, {
		name: 'player-two',
		uri: 'incredi.co/games/worlds-fastest-game/ask-name',
		properties: {
			for: 'Player 2'
		}
	}],
	timeout: 6000,
	error: [{
		uri: 'work.flow/task/restart'
	}]
});

workflow.js


require('./print-line');
require('./ask-for-player-names');

module.exports = work.flow.definition({
	name: 'worlds-fastest-game',
	uri: 'incredi.co/games/worlds-fastest-game',
	start: [{
		name: 'ask-names',
		uri: 'incredi.co/games/worlds-fastest-game/paths/ask-for-player-names'
	}, {
		name: 'determine-winner',
		uri: 'work.flow/task/if-then-else',
		properties: {
			if: {
				value: function(options, callback) {
          //@info return a random number between 1 & 2.
					return callback(null, Math.round(Math.random() * (2 - 1) + 1));
				},
				equals: 1,
				then: [{
					name: 'player-one-wins',
					uri: 'incredi.co/games/worlds-fastest-game/print-line',
					properties: {
						message: '{ask-names.player-one} WINS!!!!'
					}
				}],
				else: [{
					name: 'player-two-wins',
					uri: 'incredi.co/games/worlds-fastest-game/print-line',
					properties: {
						message: '{ask-names.player-two} WINS!!!!'
					}
				}]
			}
		}
	}, {
		uri: 'work.flow/workflow/restart'
	}],
	timeout: 6000,
	error: [{
		uri: 'work.flow/workflow/restart'
	}]
});

index.js


var workflow = require('./workflow');
//@info lets run the worlds fastest game
workflow.run(function(err, context){
  //@info The worlds fastest game is also the longest
  //      If you take a close look at the work flow
  //      It will never actually end...
  console.log('MUAHAHAHAHAHAHAHAH');
});

Installation

$ npm install work.flow --save

Development Scripts

Before running any development scripts, be sure to first install the dev modules.

$ npm install work.flow --save --dev

Build Documentation

Outputs code documentation files to the ./doc/api folder.

$ npm run doc

Static Analysis

Outputs static analysis files to the ./doc/analysis folder.

$ npm run analyze

Test + Coverage

Outputs code coverage files to the ./doc/coverage folder.

$ npm run test