Releases: winterbe/streamjs
1.6.4
1.6.3
1.6.2
Add support for streaming native Java 8 lists.
Example:
load('./stream.js');
var list = new java.util.ArrayList();
list.add(1);
list.add(2);
list.add(3);
Stream(list)
.filter(function (num) {
return num % 2 === 1;
})
.forEach(function (num) {
print(num); // 1, 3
});
1.6.1
1.6.0
This new version 1.6.0 adds additional support for ES6 features like Sets, Maps, Generators and Iterators. The unified Stream
constructor function now additionally accepts ES6 sets, maps and iterators as input. See APIDOC for further explanations.
Please keep in mind that ES6 support is optional, so Stream.js is still compatible with ES5.
Example
function* fibonacci() {
let [prev, cur] = [0, 1];
while (true) {
[prev, cur] = [cur, prev + cur];
yield cur;
}
}
Stream(fibonacci())
.filter(n => n % 2)
.takeWhile(n => n < 50)
.toArray(); // 1, 3, 5, 13, 21
1.5.0
1.4.0
This release is focused around new intermediate operations, which are well known in other languages like Haskell and Scala but not yet available in the Java 8 Streams API. The following new methods are now available in Stream.js: shuffle()
, reverse()
, slice()
, takeWhile()
and dropWhile()
. See APIDOC for further information.
Another important change is handling of null
and undefined
inputs. From now on those inputs are treated as empty collections, so you don't have to check your input for existence before creating streams: Stream(undefined).toArray(); // => []
. Here's the full list of changes for this release.
1.3.0
This release contains a bunch of new features: Each operation accepting a predicate
now also accepts a sample object or a regexp to be matched against each element of the stream. Each operation accepting a mappingFn
or a comparator
alternatively accepts a string path to be resolved against the given object. Please refer to the APIDOC for more information and various code samples. Here is full list of all closed issues for this release.
1.2.0
This release adds a couple of new features: Filter also accepts a RegExp in order to filter strings by a given pattern. Map and FlatMap accept a string path, so you can easily resolve deep nested object paths. A new terminal operation iterator
allows to traverse the elements of the stream externally. Please refer to the APIDOC for further information.