mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 20:25:48 +00:00
30 lines
548 B
JavaScript
30 lines
548 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,
|
|
};
|