UNPKG

jest-bench

Version:
25 lines 1.04 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const lodash_1 = __importDefault(require("lodash")); const benchmark_1 = __importDefault(require("benchmark")); // avoid `Cannot read property 'parentNode' of undefined` error in runScript if (global.document !== undefined && global.document.getElementsByTagName("script").length === 0) { const script = global.document.createElement("script"); global.document.body.appendChild(script); } // Benchmark could not pick up lodash otherwise const bm = benchmark_1.default.runInContext({ _: lodash_1.default }); // avoid `ReferenceError: Benchmark is not defined` error because Benchmark is assumed to be in window if (global.window !== undefined) { const win = global.window; win.Benchmark = bm; } else { const glob = global; glob.Benchmark = bm; } exports.default = bm; //# sourceMappingURL=benchmark.js.map