From 51a0932ab3c7b9e1011e8550401956a3028d6029 Mon Sep 17 00:00:00 2001 From: Dave Eddy Date: Mon, 9 Jul 2012 17:56:05 -0700 Subject: [PATCH] Fixing problem with last character being a number --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index ac1d11d..5fde7c2 100644 --- a/index.js +++ b/index.js @@ -37,7 +37,7 @@ module.exports.unpack = function(fmt, buf, pos) { if (type == +type) { // A length is given length = (length) ? length+type : ''+type; - continue; + if (i !== fmt.length - 1) continue; } length = +length || 1; @@ -49,6 +49,7 @@ module.exports.unpack = function(fmt, buf, pos) { // Push the data ret.push(data); + if (i === fmt.length - 1) return ret; // reset flag = null, length = null, data = null; }