Highland v3.0.0-beta.5 Release Notes
-
💥 Breaking changes
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
javascript 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:
javascript 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:
javascript 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.
In 3.0.0, this code should be written asjavascript 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
.
🆕 New additions