|
|
@ -1,6 +1,5 @@ |
|
|
|
'use strict' |
|
|
|
'use strict' |
|
|
|
module.exports = { |
|
|
|
export function formatMemory (mem, width) { |
|
|
|
formatMemory: function (mem, width) { |
|
|
|
|
|
|
|
const ret = {} |
|
|
|
const ret = {} |
|
|
|
if (!mem) { |
|
|
|
if (!mem) { |
|
|
|
return ret |
|
|
|
return ret |
|
|
@ -16,9 +15,9 @@ module.exports = { |
|
|
|
ret['0x' + (k / 2).toString(16)] = content.raw + '\t' + content.ascii |
|
|
|
ret['0x' + (k / 2).toString(16)] = content.raw + '\t' + content.ascii |
|
|
|
} |
|
|
|
} |
|
|
|
return ret |
|
|
|
return ret |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
tryConvertAsciiFormat: function (memorySlot) { |
|
|
|
export function tryConvertAsciiFormat (memorySlot) { |
|
|
|
const ret = { ascii: '', raw: '' } |
|
|
|
const ret = { ascii: '', raw: '' } |
|
|
|
for (let k = 0; k < memorySlot.length; k += 2) { |
|
|
|
for (let k = 0; k < memorySlot.length; k += 2) { |
|
|
|
const raw = memorySlot.substr(k, 2) |
|
|
|
const raw = memorySlot.substr(k, 2) |
|
|
@ -31,9 +30,9 @@ module.exports = { |
|
|
|
ret.raw += raw |
|
|
|
ret.raw += raw |
|
|
|
} |
|
|
|
} |
|
|
|
return ret |
|
|
|
return ret |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* format @args css1, css2, css3 to css inline style |
|
|
|
* format @args css1, css2, css3 to css inline style |
|
|
|
* |
|
|
|
* |
|
|
|
* @param {Object} css1 - css inline declaration |
|
|
|
* @param {Object} css1 - css inline declaration |
|
|
@ -44,7 +43,7 @@ module.exports = { |
|
|
|
* if the key start with * the value is direcly appended to the inline style (which should be already inline style formatted) |
|
|
|
* if the key start with * the value is direcly appended to the inline style (which should be already inline style formatted) |
|
|
|
* used if multiple occurences of the same key is needed |
|
|
|
* used if multiple occurences of the same key is needed |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
formatCss: function (css1, css2) { |
|
|
|
export function formatCss (css1, css2) { |
|
|
|
let ret = '' |
|
|
|
let ret = '' |
|
|
|
for (let arg in arguments) { |
|
|
|
for (let arg in arguments) { |
|
|
|
for (let k in arguments[arg]) { |
|
|
|
for (let k in arguments[arg]) { |
|
|
@ -58,17 +57,17 @@ module.exports = { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return ret |
|
|
|
return ret |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
normalizeHex: function (hex) { |
|
|
|
export function normalizeHex (hex) { |
|
|
|
if (hex.indexOf('0x') === 0) { |
|
|
|
if (hex.indexOf('0x') === 0) { |
|
|
|
hex = hex.replace('0x', '') |
|
|
|
hex = hex.replace('0x', '') |
|
|
|
} |
|
|
|
} |
|
|
|
hex = hex.replace(/^0+/, '') |
|
|
|
hex = hex.replace(/^0+/, '') |
|
|
|
return '0x' + hex |
|
|
|
return '0x' + hex |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
normalizeHexAddress: function (hex) { |
|
|
|
export function normalizeHexAddress (hex) { |
|
|
|
if (hex.indexOf('0x') === 0) hex = hex.replace('0x', '') |
|
|
|
if (hex.indexOf('0x') === 0) hex = hex.replace('0x', '') |
|
|
|
if (hex.length >= 40) { |
|
|
|
if (hex.length >= 40) { |
|
|
|
const reg = /(.{40})$/.exec(hex) |
|
|
|
const reg = /(.{40})$/.exec(hex) |
|
|
@ -78,9 +77,8 @@ module.exports = { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return '0x' + (new Array(40 - hex.length + 1).join('0')) + hex |
|
|
|
return '0x' + (new Array(40 - hex.length + 1).join('0')) + hex |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
runInBrowser: function () { |
|
|
|
export function runInBrowser () { |
|
|
|
return typeof window !== 'undefined' |
|
|
|
return typeof window !== 'undefined' |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|