Douglas Crockford

Blog

Books

Videos

2024 Appearances

JavaScript

Misty

JSLint

JSON

Github

Electric Communities

Mastodon/Layer8

Flickr Photo Album

ResearchGate

LinkedIn

Pronouns: pe/per

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.