@atixlabs/hardhat-time-n-mine
Version:
Hardhat plugin to manipulate time and mine blocks
19 lines • 751 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseDelta = void 0;
const ms_1 = __importDefault(require("ms"));
const parseDelta = (delta) => {
const deltaInSeconds = Number.isNaN(Number(delta))
? ms_1.default(delta) / 1000
: Number(delta);
if (!Number.isInteger(deltaInSeconds))
throw new Error("cannot be called with a non integer value");
if (deltaInSeconds < 0)
throw new Error("cannot be called with a negative value");
return deltaInSeconds;
};
exports.parseDelta = parseDelta;
//# sourceMappingURL=param-parsing.js.map