ethers.js/packages/testcases/lib.esm/browser.js

25 lines
984 B
JavaScript
Raw Normal View History

'use strict';
import path from 'path';
import zlib from "browserify-zlib";
import { randomBytes, randomHexString, randomNumber } from "./random";
export { randomBytes, randomHexString, randomNumber };
2020-09-23 06:18:45 +03:00
import * as _data from "./browser-fs.json";
// TypeScript, rollup and friends don't play nice with this JSON
const _anyData = _data;
const data = _anyData["default"] ? _anyData["default"] : _anyData;
const Cache = {};
export function loadTests(tag) {
let filename = 'testcases/' + tag + ".json.gz";
if (Cache[filename] == null) {
console.log("loading:", filename);
Cache[filename] = JSON.parse(zlib.gunzipSync(new Buffer(data[filename], "base64")).toString());
}
return Cache[filename];
}
export function loadData(filename) {
// Strip any leading relative paths (e.g. "./foo" => "foo")
filename = path.join(filename);
console.log("loading:", filename);
return new Buffer(data[filename], "base64");
}
2020-07-13 15:03:56 +03:00
//# sourceMappingURL=browser.js.map