string-code.js
329 Bytes
'use strict';
const _ = require('lodash');
const utf8ToHex = (string) => {
var buf = new Buffer(string, 'utf8');
return _.toUpper(buf.toString('hex'));
};
const hexToUtf8 = (string) => {
let buf = new Buffer(string, 'hex');
return buf.toString('utf8');
};
module.exports = {
utf8ToHex,
hexToUtf8
};