You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930
  1. const fs = require("fs");
  2. const { Buffer } = require('buffer/')
  3. function hexOnly(hex) {
  4. return hex.replace(/[^a-fA-F0-9]/g, "");
  5. }
  6. function unused() {}
  7. function parseHexOnly(hex) {
  8. return Buffer.from(hexOnly(hex), "hex");
  9. }
  10. function loadFixture(relativePath) {
  11. const fn = __dirname + "/fixtures/" + relativePath;
  12. return require(fn);
  13. }
  14. function loadFixtureText(relativePath) {
  15. const fn = __dirname + "/fixtures/" + relativePath;
  16. return fs.readFileSync(fn).toString("utf8");
  17. }
  18. module.exports = {
  19. hexOnly,
  20. parseHexOnly,
  21. loadFixture,
  22. loadFixtureText,
  23. unused,
  24. };