Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function d2h(d: string): string {
let h = decToHex(d).substr(2);
let neg = false;
if (h[0] === "-") {
h = h.substr(1);
neg = true;
}
return neg ? `-${pad(h, 16)}` : pad(h, 16);
}
.map(b => `0x${pad(b, 2)}`)
.join(", ");
case s.Value.FLOAT64:
return ts.createNumericLiteral(value.getFloat64().toString());
case s.Value.INT16:
return ts.createNumericLiteral(value.getInt16().toString());
case s.Value.INT32:
return ts.createNumericLiteral(value.getInt32().toString());
case s.Value.INT64:
const int64 = value.getInt64();
const int64Bytes: string[] = [];
for (let i = 0; i < 8; i++) {
int64Bytes.push(`0x${pad(int64.buffer[i].toString(16), 2)}`);
}
const int64ByteArray = ts.createArrayLiteral(
int64Bytes.map(ts.createNumericLiteral),
false
);
const int64ArrayBuffer = ts.createNew(
ts.createIdentifier("Uint8Array"),
__,
[int64ByteArray]
);
return ts.createNew(ts.createIdentifier("capnp.Int64"), __, [
int64ArrayBuffer
]);
case s.Value.INT8: