whitespace and comment cleanup
This commit is contained in:
parent
077532ab33
commit
e11120ae29
@ -2,26 +2,26 @@
|
|||||||
|
|
||||||
var Enc = module.exports;
|
var Enc = module.exports;
|
||||||
|
|
||||||
Enc.base64ToBuf = function base64ToBuf(str) {
|
Enc.base64ToBuf = function (str) {
|
||||||
// node handles both base64 and urlBase64 equally
|
// node handles both base64 and urlBase64 equally
|
||||||
return Buffer.from(str, 'base64');
|
return Buffer.from(str, 'base64');
|
||||||
};
|
};
|
||||||
|
|
||||||
Enc.base64ToHex = function base64ToHex(b64) {
|
Enc.base64ToHex = function (b64) {
|
||||||
return Enc.bufToHex(Enc.base64ToBuf(b64));
|
return Enc.bufToHex(Enc.base64ToBuf(b64));
|
||||||
};
|
};
|
||||||
|
|
||||||
Enc.bufToBase64 = function toHex(u8) {
|
Enc.bufToBase64 = function (u8) {
|
||||||
// Ensure a node buffer, even if TypedArray
|
// Ensure a node buffer, even if TypedArray
|
||||||
return Buffer.from(u8).toString('base64');
|
return Buffer.from(u8).toString('base64');
|
||||||
};
|
};
|
||||||
|
|
||||||
Enc.bufToHex = function bufToHex(u8) {
|
Enc.bufToHex = function (u8) {
|
||||||
// Ensure a node buffer, even if TypedArray
|
// Ensure a node buffer, even if TypedArray
|
||||||
return Buffer.from(u8).toString('hex');
|
return Buffer.from(u8).toString('hex');
|
||||||
};
|
};
|
||||||
|
|
||||||
Enc.bufToUrlBase64 = function bufToUrlBase64(u8) {
|
Enc.bufToUrlBase64 = function (u8) {
|
||||||
return Enc.bufToBase64(u8)
|
return Enc.bufToBase64(u8)
|
||||||
.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
|
.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
|
||||||
};
|
};
|
||||||
@ -33,7 +33,7 @@ Enc.hexToUint8 = function (hex) {
|
|||||||
return new Uint8Array(ab);
|
return new Uint8Array(ab);
|
||||||
};
|
};
|
||||||
|
|
||||||
Enc.numToHex = function numToHex(d) {
|
Enc.numToHex = function (d) {
|
||||||
d = d.toString(16);
|
d = d.toString(16);
|
||||||
if (d.length % 2) {
|
if (d.length % 2) {
|
||||||
return '0' + d;
|
return '0' + d;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user