Skip to content

Commit

Permalink
Only arson.registerType("Buffer", ...) when Buffer defined.
Browse files Browse the repository at this point in the history
Fixes #1.
  • Loading branch information
benjamn committed May 11, 2016
1 parent f9d522a commit c28406a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ var mapTag = "[object Map]";

var arson = require("./index.js");

typeof Buffer === "function" &&
typeof Buffer.isBuffer === "function" &&
arson.registerType("Buffer", {
deconstruct: function (buf) {
return Buffer.isBuffer(buf) && [buf.toString("base64"), "base64"];
Expand Down

0 comments on commit c28406a

Please sign in to comment.