Skip to content

Commit

Permalink
Fix Java 8 Nashorn ReferenceError
Browse files Browse the repository at this point in the history
  • Loading branch information
winterbe committed Jul 3, 2015
1 parent 8ae851d commit 07dafef
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 13 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "streamjs",
"version": "1.6.0",
"version": "1.6.1",
"homepage": "https://github.com/winterbe/streamjs",
"authors": ["Benjamin Winterberg"],
"description": "Lazy Object Streaming Pipeline for JavaScript - inspired by the Java 8 Streams API",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "streamjs",
"version": "1.6.0",
"version": "1.6.1",
"description": "Lazy Object Streaming Pipeline for JavaScript - inspired by the Java 8 Streams API",
"homepage": "https://github.com/winterbe/streamjs",
"author": {
Expand Down
4 changes: 2 additions & 2 deletions stream-min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion stream-min.map

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions stream.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/**
* Stream.js v1.6.0
* Stream.js v1.6.1
* https://github.com/winterbe/streamjs
* Copyright (c) 2014-2015 Benjamin Winterberg
* Stream.js may be freely distributed under the MIT license.
*/
(function () {
;(function () {
"use strict";

var root = this,
version = "1.6.0",
var root = (typeof global == 'object' && global) || this,
version = "1.6.1",
ctx = {},
nil = {};

Expand Down Expand Up @@ -1155,11 +1155,11 @@
};

function isSet(obj) {
return !!Set && obj instanceof Set && isFunction(obj.values);
return !!root.Set && obj instanceof Set && isFunction(obj.values);
}

function isMap(obj) {
return !!Map && obj instanceof Map && isFunction(obj.values);
return !!root.Map && obj instanceof Map && isFunction(obj.values);
}

function isIterator(obj) {
Expand All @@ -1175,7 +1175,7 @@
}

function isConsoleFn(fn) {
if (!console) {
if (!root.console) {
return false;
}
return console.log === fn || console.warn === fn || console.error === fn || console.trace === fn;
Expand Down
2 changes: 1 addition & 1 deletion test/test-misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ QUnit.test("toString", function (assert) {
});

QUnit.test("version", function (assert) {
assert.equal(Stream.VERSION, "1.6.0");
assert.equal(Stream.VERSION, "1.6.1");
});

QUnit.test("noConflict", function (assert) {
Expand Down
13 changes: 13 additions & 0 deletions test/test-nashorn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// run this file via terminal:
//
// jjs test-nashorn.js

load('../stream.js');

var max = Stream({a: 1, b: 2, c: 3})
.filter(function (num) {
return num % 2 === 1;
})
.forEach(function (num) {
print(num);
});

0 comments on commit 07dafef

Please # to comment.