Skip to content

Commit

Permalink
fix(int64-coerce): node 4 doesn't allow us to pass Int64s to Buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst committed Oct 11, 2015
1 parent 04893e7 commit 347070c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/utilities.js
@@ -1,6 +1,7 @@
'use strict';

var _ = require('lodash'),
Int64 = require('node-int64'),

constants = require('./constants'),
errors = require('./errors'),
Expand Down Expand Up @@ -202,6 +203,7 @@ utilities.deepCopy = deepMerge;
function coerce(val, T) {
if (val === null || val === undefined) return null;
if (val instanceof T) return val;
if (val instanceof Int64 && T === Buffer) return val.toBuffer();

if (val instanceof Array) {
// Is there really no way to bind the second argument to a fn?
Expand Down

0 comments on commit 347070c

Please sign in to comment.