UNPKG

iobroker.js-controller

Version:

Updated by reinstall.js on 2018-06-11T15:19:56.688Z

51 lines (50 loc) 1.88 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var utils_exports = {}; __export(utils_exports, { DEFAULT_DISK_WARNING_LEVEL: () => DEFAULT_DISK_WARNING_LEVEL, getCronExpression: () => getCronExpression, getDiskWarningLevel: () => getDiskWarningLevel }); module.exports = __toCommonJS(utils_exports); function getDiskWarningLevel(state) { let warningLevel = 0; if (typeof state.val === "number" && state.val <= 100 && state.val >= 0) { warningLevel = state.val; } return warningLevel; } const DEFAULT_DISK_WARNING_LEVEL = 5; const MAX_SCHEDULE_DELAY = 59; function getCronExpression(options) { const { cronExpression, connectionType } = options; const cronHasSeconds = cronExpression.split(" ").length > 5; if (cronHasSeconds || connectionType !== "cloud") { return cronExpression; } const randomSeconds = Math.round(Math.random() * MAX_SCHEDULE_DELAY); return `${randomSeconds} ${cronExpression}`; } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { DEFAULT_DISK_WARNING_LEVEL, getCronExpression, getDiskWarningLevel }); //# sourceMappingURL=utils.js.map