Merge pull request #121 from mkononen/master

Fix to issue #120
This commit is contained in:
Mark Cavage 2013-02-28 07:11:08 -08:00
commit d84456db12
1 changed files with 4 additions and 2 deletions

View File

@ -185,7 +185,9 @@ Attribute.prototype.toString = function () {
function formatGuid(format, data) {
for (var i = 0; i < data.length; i++) {
var re = new RegExp('\\{' + i + '\\}', 'g');
format = format.replace(re, data[i].toString(16));
// Leading 0 is needed if value of data[i] is less than 16 (of 10 as hex).
var dataStr = data[i].toString(16);
format = format.replace(re, data[i] >= 16 ? dataStr : '0' + dataStr);
}
return format;
}
}