Skip to content

Commit

Permalink
Don't test Map and Set unless Array.from is defined.
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamn committed Feb 15, 2016
1 parent 2b509df commit d25782b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ arson.registerType("RegExp", {
});

typeof Set === "function" &&
typeof Array.from === "function" &&
arson.registerType("Set", {
deconstruct: function (set) {
if (toString.call(set) === setTag) {
Expand All @@ -78,6 +79,7 @@ arson.registerType("Set", {
});

typeof Map === "function" &&
typeof Array.from === "function" &&
arson.registerType("Map", {
deconstruct: function (map) {
if (toString.call(map) === mapTag) {
Expand Down
2 changes: 2 additions & 0 deletions test/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ describe("encoding and decoding", function () {
});

typeof Map === "function" &&
typeof Array.from === "function" &&
it("should work with Map objects", function () {
var m1 = new Map;
var value = { foo: 42 };
Expand All @@ -75,6 +76,7 @@ describe("encoding and decoding", function () {
});

typeof Set === "function" &&
typeof Array.from === "function" &&
it("should work with Set objects", function () {
var s1 = new Set;
s1.add(s1);
Expand Down

0 comments on commit d25782b

Please sign in to comment.