From fed2bd6ab841baaa8993f7ff853db638dbb83ede Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Thu, 29 Jan 2015 12:33:14 -0800 Subject: [PATCH] fixed a bug in updateDigestForJsonValue with how null was handled --- src/esnext.coffee | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/esnext.coffee b/src/esnext.coffee index faee71ea7..e23d048d4 100644 --- a/src/esnext.coffee +++ b/src/esnext.coffee @@ -51,13 +51,14 @@ updateDigestForJsonValue = (shasum, value) -> # * Strings are not escaped. # * No effort is made to avoid trailing commas. # These shortcuts should not affect the correctness of this function. - if typeof value is 'string' + type = typeof value + if type is 'string' shasum.update('"', 'utf8') shasum.update(value, 'utf8') shasum.update('"', 'utf8') - else if typeof value in ['boolean', 'number'] + else if type in ['boolean', 'number'] shasum.update(value.toString(), 'utf8') - else if typeof value is null + else if value is null shasum.update('null', 'utf8') else if Array.isArray value shasum.update('[', 'utf8')