"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.cronExpressionToParts = cronExpressionToParts; exports.cronPartsToExpression = cronPartsToExpression; /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ function cronExpressionToParts(expression) { const parsedCron = { second: undefined, minute: undefined, hour: undefined, day: undefined, date: undefined, month: undefined }; const parts = expression.split(' '); if (parts.length >= 1) { parsedCron.second = parts[0]; } if (parts.length >= 2) { parsedCron.minute = parts[1]; } if (parts.length >= 3) { parsedCron.hour = parts[2]; } if (parts.length >= 4) { parsedCron.date = parts[3]; } if (parts.length >= 5) { parsedCron.month = parts[4]; } if (parts.length >= 6) { parsedCron.day = parts[5]; } return parsedCron; } function cronPartsToExpression({ second, minute, hour, day, date, month }) { return `${second} ${minute} ${hour} ${date} ${month} ${day}`; }