This file does not aim to be comprehensive (you have git history for that), rather it lists changes that might impact your own code as a consumer of this library.
fork
- Updates the documentation forfork
to match the better version from 2.x.
takeWhile
- returns a new stream that ends when the function passed as a parameter stops returning true. #677.- Async Iterator/Iterable support - Async iterators and iterables (as defined by the Async Iteration specs), can now be passed to the Highland constructor function. #682.
This release contains all changes from 2.13.3.
This release contains all changes from 2.13.1.
ap
- Applies a stream of function(s) to the stream of value(s). #643.empty
- Creates an empty stream. #657.- Implements the Fantasy Land Alternative, Filterable, and Monad specifications. #658.
This release contains all changes from 2.12.0.
-
toNodeStream
- In 2.x, if you calltoNodeStream
on a Highland stream that emits objects without setting{objectMode: true}
, the resultingReadable
may simply ignore any objects that are emitted (depending on the implementation ofStringDecoder
). In 3.x, theReadable
will always emit an error.Also, in 2.x, calling
toNodeStream
will immediately consume the source. In 3.x, the source stream will only be consumed when theReadable
is consumed.
stopOnError
- updatestopOnError
documentation to includepush
#650.
stream.source
- The (undocumented)source
property on a stream no longer exists.consume
- It is no longer possible toconsume
the same stream multiple times, even after the originalconsume
has pushednil
. Attempting to do so will result in an error. This affects all transforms that are implemented viaconsume
.- Old Behavior: Code like this used to work
const stream = _([1, 2, 3]); stream.take(1) .toArray(array => { console.log(array); // => [1] stream.take(1).toArray(array2 => { console.log(array2); // => [2] stream.take(1).toArray(array3 => { console.log(array3); // => [3] }); }); });
- New Behavior:
const stream = _([1, 2, 3]); stream.take(1) .toArray(array => { console.log(array); // => [1] stream.take(1); // The call to take(1) will fail. });
- Old Behavior: Code like this used to work
drop
#559 Fixes #594- Old Behavior: if
n
isn't a number or is negative, it defaults to0
. - New Behavior: if
n
is not a number or if it is negative, an error is thrown.
- Old Behavior: if
fork
- It is no longer possible to callfork
after a call toconsume
on the same stream. Attempting to do so will result in an error. This also applies to all transforms. Note that each transform returns a new stream, so it is still possible to fork a stream that has been transformed.- Code like this used to work:
In 3.0.0, this code should be written as
const stream = _([1, 2, 3]).map(x => x + 1); const fork1 = stream.map(x => x * 2); // stream is consumed. const fork2 = stream.fork().map(x => x * 3); // then forked. // fork1 and fork2 share backpressure.
const stream = _([1, 2, 3]).map(x => x + 1); const fork1 = stream.fork().map(x => x * 2); // stream must be explicitly forked const fork2 = stream.fork().map(x => x * 3);
- Code like this used to work:
map
- Passing a non-function value tomap
now throws an error.- Old Behavior - Passing a non-function value to
map
caused it to map all stream values to the passed in value.
- Old Behavior - Passing a non-function value to
reduce
- The order of the arguments toreduce
has been swapped.- Old Behavior:
stream.reduce(memo, reducer)
- New Behavior:
stream.reduce(reducer, memo)
- Old Behavior:
scan
- The order of the arguments toscan
has been swapped.- Old Behavior:
stream.scan(memo, reducer)
- New Behavior:
stream.scan(reducer, memo)
- Old Behavior:
slice
#559 Fixes #594- Old Behavior: if
start
isn't a number, it defaults to0
, and ifend
isn't a number, it defaults toInfinity
. Ifstart
orend
are negative, they are treated as if they are0
instead. - New Behavior: if
start
orend
are not numbers or if they are negative, an error is thrown.start
andend
are optional and default to0
andInfinity
, respectively.
- Old Behavior: if
take
#559 Fixes #594- Old Behavior: if
n
isn't a number, it defaults toInfinity
. Ifn
is negative, it is treated as if it is0
. - New Behavior: if
n
is not a number or if it is negative, an error is thrown.
- Old Behavior: if
zipAll
-zipAll
has been renamedzipEach
.zipAll0
-zipAll0
has been renamedzipAll
.
wrapAsync
: Wraps a function that returns a promise, transforming it to a function which accepts the same arguments and returns a Highland Stream instead. #548. Fixes #517.
- Fixes a bug in
pipe
where errors would be emitted twice.
- Fixes a regression in the
through
transform. If it is called with an un-paused through stream and the source Highland stream has buffered data (or generates data synchronously), then that data may be lost. #671. - Fix
pipe
so that it does not emit data synchronously. This allows for chained pipes to work properly even if a stream in the middle of the pipe is unpaused. #671.
- Fixes a potential deadlock when wrapping node
Readables
in node 10+. #670.
isNil
: Returnstrue
if the argument is the end of stream marker. This can be useful as a user-defined type guard in Typescript. #645
toNodeStream
: Returns a native node Readable #644
- Remove usages of
Function.prototype.bind
. We support IE8. #632. - Add a section about supported JS engines to the documentation.
toPromise
: Converts a one-element or zero-element stream to a Promise given a Promise/A+ compliant promise constructor. #628. Fixes #627.
- Streams constructed from an
EventEmitter
orjQuery
element will now remove itself when the stream is destroyed. Fixes #500. #609.
- Same as
2.10.3
but with a more conservative fix to minimize the risk of regressions.
- In certain cases, consuming a stream that has been resumed may cause a stream generator/consume handler to be called twice without next() ever being called. This is mostly relevant for .each(...).done(...) use cases. Noticed in #570 (comment). #608.
- Uncaught errors from promise-back streams weren't being correctly logged in certain circumstances when using a Promise implementation that does not log unhandled promise exceptions. All uncaught highland errors should now be correctly logged. #591. Fixes #589.
- Users using bluebird as their Promise implementation may have seen an error that says "a promise was created in a handler at ... but was not returned from it". This is a false positive, and Highland's use of promises have been updated to suppress this warning. #588.
- Asynchronously pushing a
nil
inconsume
when then input value wasn't anil
itself now no longer causes the stream to deadlock. #564. Fixes #563. Related to #558. - Much improved documentation. Examples are now more standalone, and more guidance was added for certain common pitfalls.
of
: Creates a stream that sends a single value then ends. #520.fromError
: Creates a stream that sends a single error then ends. #520.- When constructing a Highland stream from a Node Readable, the
onFinish
handler may now turn off the default automatic end on errors behavior by returning an object with the propertycontinueOnError
set totrue
. #534. Fixes #532.
- It is now possible to pass an custom
onFinish
handler when constructing a Highland Stream from a Node Readable Stream. This allows for special detection of stream completion when necessary. #505. See #490 for a discussion on why this is necessary.
-
The
Readable
stream wrapper changes from2.8.0
assumed thatclose
would never be emitted beforeend
for any stream. This is not the case forSockets
, which willclose
when the client disconnects but willend
only when it has piped all of its data. For a slow consumer,end
may happen afterclose
, causing the Highland stream to drop all data afterclose
is emitted.This release fixes the regression at the cost of restoring the old behavior of never ending the Stream when only
close
is emitted. This does not affect the case whereerror
events are emitted withoutend
. That still works fine. To manually end a stream when it emitsclose
, listen to the event and callstream.end()
. Fixes #490.
- A Highland Stream that wraps
Readable
now properly handles the case where theReadable
emits theclose
event but not theend
event (this can happen with anfs
read stream when it encounters an error). It will also end the wrapper stream when it encounters an error (this happens when reading from a non-existent file). Before, such streams would simply never end. #479. Fixes #478.
toCallback
: method for returning the result of a stream to a nodejs-style callback function. #493. Fixes #484.
- A Highland Stream that wraps a bluebird promise can now handle bluebird cancellation. When the promise is cancelled the wrapper stream is empty. #487. Fixes #486.
mergeWithLimit
no longer causes an// Unhandled 'error' event
error when one of its sources emits an error. #476. Fixes #475.
pipe
now properly unbinds itsdrain
handler from the destination when it is done. Previously, there would have been a memory leak if the destination is long-lived (e.g., as withprocess.stdout
). #466.
- Minor fixes to the documentation.
- The library's browserify bundle is now published to NPM alongside the regular code. #310. Fixes #309.
pipe
now takes a second, optional options argument that allows users to decide whether or not to end the destination stream when the source ends. #450.
Broken release. Use 2.7.1
instead.
parallel
no longer drops elements on the floor in a number of cases. #302, #331. Fixes #234, #328.- Calling
next
beforepush
within a generator stream no longer causes the stream to resume and throw away data when used withpull
. #326. Fixes #325. - Parallel no longer drops data if paused. #331. Fixes #328.
- Various grammar fixes and documentation updates. #341, #354, #381, #397, #407
isStream
now always returns a boolean. Before, it would returnundefined
if the argument was an object but not a Highland stream. #343.- Streams now unpipe from Readable on destroy. #361.
_send
now keeps a reference to the correct consumer/observer array. #367. Fixes #366.- Streams constructed with
pipeline
now correctly exert backpressure. #372, #377. Also fixes an possible issue with not consuming errors from promises. #391. - It is no longer possible to re-enter the consume callback. #393.
mergeWithLimit
: Likemerge
, but with an argument to specify the maximum number of parallel stream that can be consumed at once. #375.- minified build: There is now a minified version of the browser build under
dist/highland.min.js
. #392. wrapCallback
: The function now takes a second argument (mappingHint
) that describes how arguments passed to the callback are handled. It behaves like themappingHint
parameter of the stream constructor. #247. Fixes #246, #334.- Node 4 and 5: Added support for node 4 and 5. #383.
- The runtime of
pick
per object is nowO(n)
, wheren
is the number of properties to be picked. It was previouslyO(mn)
, wherem
is the number of pickable properties on the object. #286. - Both
pick
andpickBy
can now select non-enumerable keys. #286. parallel
now throws descriptive errors if it encounters a value that is not a stream. #318.- The standalone Highland file is now built using Browserify 12.0.1.
- Updates a number of
devDependencies
. If you develop on Highland, make sure to update the dependencies. #384, #385, #387, #390, #400, #403, #415. uniq
now uses a Set to compute uniqueness whenever available, resulting in a significant performance boost for large streams. The definition of equality is still===
, not theSameValueZero
algorithm used bySet
. #395parallel
now throws if provided an argument that is not a number. #421.
- Dropped support for Node 0.11.
- Dropped support for iojs.
- Deprecation warnings for API changes upcoming in version 3.0.0 have been added. #417
- Move stream check in constructor to beginning of object branch. #303
drop
: Ignores the firstn
values of a stream and then emits the rest. #75 #244done
: Calls the supplied function once the stream has ended. #161sort
: Collects all values together then emits each value individually but in sorted order. #169 #245streamifyAll
: Takes an object or a constructor function and returns that object or constructor with streamified versions of its function properties. #226Iterator
Support: ECMA2015 (aka ES6) style iterators can now be passed to the Highland constructor function. #235slice
: Creates a new stream with the values from the source in the range of specified in thestart
andend
parameters. #250batchWithTimeOrCount
: Takes one Stream and batches incoming data within a maximum time frame into arrays of a maximum length. #284
each
now returns an empty stream rather than nothing. #161.- Ensure
through
propagates Node stream errors. #240 - Preserve
this
context of wrapped function when usingwrapCallback
. #248 - Update
tranduce
to use latest version of transformer protocol. #261
- The
source.merge()
algorithm now evaluates the entire source stream before reading from all of the resulting streams in parallel (previously it would start reading as soon as the source emitted the next stream) - The
merge()
function now attempts to balance inputs more fairly. For example, if stream A has 100 values buffered and stream B gets a new value after 100ms, if we read at 200ms we'll get a value from each stream. Previously it would exhaust the stream A buffer before reading from stream B.