Files
xahau.js/packages/ripple-binary-codec/test/utils.js
Nathan Nichols 2e6c68ba73 ripple-binary-codec refactor (#88)
Refactored all components in ripple-binary-codec /src
2020-07-31 09:14:11 -05:00

30 lines
545 B
JavaScript

const fs = require('fs')
function hexOnly (hex) {
return hex.replace(/[^a-fA-F0-9]/g, '')
}
function unused () {}
function parseHexOnly (hex) {
return Buffer.from(hexOnly(hex), 'hex');
}
function loadFixture (relativePath) {
const fn = __dirname + '/fixtures/' + relativePath
return require(fn)
}
function loadFixtureText (relativePath) {
const fn = __dirname + '/fixtures/' + relativePath
return fs.readFileSync(fn).toString('utf8')
}
module.exports = {
hexOnly,
parseHexOnly,
loadFixture,
loadFixtureText,
unused
}