UNPKG

read-excel-file

Version:

Read `.xlsx` files in a web browser or in Node.js

33 lines (30 loc) 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = checkpoint; exports.latestCheckpointTimestamp = void 0; exports.resetCheckpoint = resetCheckpoint; // This code is used to profile reading `.xlsx` files. // It shows how much time each stage executes for. // To enable the logs with the timing, set a global variable // called `READ_EXCEL_FILE_CHECKPOINTS` in Node.js or web browser. // This global variable is only exported to be added in the dependencies of a worker function. // See `worker-f` package for more info. var latestCheckpointTimestamp; function checkpoint(name) { var now = Date.now(); // See if the global flag for "should output log" is set to `true`. var shouldOutputLog = typeof global !== 'undefined' ? Boolean(global.READ_EXCEL_FILE_CHECKPOINTS) : typeof window !== 'undefined' ? Boolean(window.READ_EXCEL_FILE_CHECKPOINTS) : false; if (shouldOutputLog) { if (latestCheckpointTimestamp) { console.log(' -', now - latestCheckpointTimestamp, 'ms'); } console.log('*', name); } exports.latestCheckpointTimestamp = latestCheckpointTimestamp = now; } function resetCheckpoint() { exports.latestCheckpointTimestamp = latestCheckpointTimestamp = undefined; } //# sourceMappingURL=checkpoint.js.map