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

ty-step

v1.0.1

Published

简单的异步流程控制方法,可以并行和串行执行给出的方法序列,适用于nodejs和浏览器环境

Downloads

6

Readme

ty-step

异步流程控制,可以以并行或串行的方式执行给定的函数序列,支持参数传递和错误捕获

Inspired by step and gulp-sequence


Install

npm install ty-step

Usage

var step = require('ty-step')
var af = function(time) {
	return function(next, payload) {
		setTimeout(function() {
			next(null, time)
		}, time)
	}
}
var task = step(af(200), af(100), [af(150), af(80), af(250)], af(400), af(50))
task(function(err, payload) {
	if(err)
		console.error(err)
	else
		console.log(payload) // payload = [200, 100, [80, 150, 250], 400, 50]
})

step接收一系列的函数或者由函数组成的数组作为参数,这些函数代表要执行的任务,接收nextpayload作为参数。next在任务结束时调用,传入的参数为errordataerror代表上一个函数是否发生了错误,若不为null则表示发生了错误,会中断执行后续函数,data表示上一个函数中next传递的结果。step返回一个函数,该函数接收一个callback作为参数,表示对最终结果的处理,同样接收errordata作为参数

License

MIT