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 to consume the same stream multiple times, even after the original consume has pushed nil. Attempting to do so will result in an error. This affects all transforms that are implemented via consume.
      • 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. });
    • drop #559 Fixes #594
      • Old Behavior: if n isn't a number or is negative, it defaults to 0.
      • New Behavior: if n is not a number or if it is negative, an error is thrown.
    • fork - It is no longer possible to call fork after a call to consume 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 as javascript 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);
    • map - Passing a non-function value to map 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.
    • reduce - The order of the arguments to reduce has been swapped.
      • Old Behavior: stream.reduce(memo, reducer)
      • New Behavior: stream.reduce(reducer, memo)
    • scan - The order of the arguments to scan has been swapped.
      • Old Behavior: stream.scan(memo, reducer)
      • New Behavior: stream.scan(reducer, memo)
    • slice #559 Fixes #594
      • Old Behavior: if start isn't a number, it defaults to 0, and if end isn't a number, it defaults to Infinity. If start or end are negative, they are treated as if they are 0 instead.
      • New Behavior: if start or end are not numbers or if they are negative, an error is thrown. start and end are optional and default to 0 and Infinity, respectively.
    • take #559 Fixes #594
      • Old Behavior: if n isn't a number, it defaults to Infinity. If n is negative, it is treated as if it is 0.
      • New Behavior: if n is not a number or if it is negative, an error is thrown.
    • zipAll - zipAll has been renamed zipEach.
    • zipAll0 - zipAll0 has been renamed zipAll.

    🆕 New additions

    • 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.