Douglas Crockford

Blog

Books

Videos

2025 Appearances

Slides

JavaScript

Misty

JSLint

JSON

Github

Electric Communities

Flickr Photo Album

LinkedIn

Mastodon/Layer8

ResearchGate

Pronouns: pe/per

Aptera

About

Doing Nothing With Parseq

I made a change to Parseq. The parallel factory and the sequence factory will no longer throw errors when empty requestor arrays are passed in.

parseq.parallel([], [])(callback, initial_value) ≡ callback([])
parseq.sequence([])(callback, initial_value)     ≡ callback(initial_value)

If no requestors are passed, then parallel will pass an empty array to the callback, and sequence will pass the initial_value to the callback.

This tolerates workflows in which array.filter is used to produce the array of requestor functions. If the array is empty, parallel and sequence will nop in reasonable ways.

The race and fallback factories will still throw if they are not given requestors because they are only successful if a requestor is successful.

Parseq
Parseq on Github
How JavaScript Works, Chapter 20