better temple output
This commit is contained in:
parent
abce2cc95b
commit
70ba729899
1 changed files with 11 additions and 7 deletions
14
lib/asn1.js
14
lib/asn1.js
|
@ -163,23 +163,27 @@ ASN1.tpl = function (asn1) {
|
|||
var val;
|
||||
if ('number' !== typeof k) {
|
||||
// ignore
|
||||
} else if (k) {
|
||||
str += ', ';
|
||||
} else {
|
||||
str += ' ';
|
||||
str += ', ';
|
||||
}
|
||||
if (0x02 === asn1.type) {
|
||||
str += "ASN1.UInt(";
|
||||
} else if (0x03 === asn1.type) {
|
||||
str += "ASN1.BitStr(";
|
||||
} else {
|
||||
str += "ASN1('" + Enc.numToHex(asn1.type) + "', ";
|
||||
str += "ASN1('" + Enc.numToHex(asn1.type) + "'";
|
||||
}
|
||||
if (!asn1.children) {
|
||||
if (0x05 !== asn1.type) {
|
||||
val = Buffer.from(asn1.value || '');
|
||||
vars.push("// 0x" + Enc.numToHex(val.byteLength) + " (" + val.byteLength + " bytes)\nvar tpl" + i + " = '"
|
||||
+ Enc.bufToHex(val) + "';");
|
||||
str += "tpl" + i + ")";
|
||||
if (0x02 !== asn1.type && 0x03 !== asn1.type) {
|
||||
str += ", ";
|
||||
}
|
||||
str += "tpl" + i;
|
||||
}
|
||||
str += ")";
|
||||
return ;
|
||||
}
|
||||
asn1.children.forEach(function (a, j) {
|
||||
|
|
Loading…
Reference in a new issue