CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-cronstrue

tessl install tessl/npm-cronstrue@3.2.0

Convert cron expressions into human readable descriptions

Agent Success

Agent success rate when using this tile

100%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.12x

Baseline

Agent success rate without this tile

89%

task.mdevals/scenario-1/

Cron Expression Validator

Build a cron expression validator that checks if user-submitted cron expressions are valid and provides helpful error feedback when they contain out-of-range values.

Requirements

Your validator should:

  1. Accept cron expressions as strings and validate them
  2. Return a validation result object containing:
    • isValid: boolean indicating if the expression is valid
    • errorMessage: string describing what's wrong (only if invalid)
    • description: human-readable description of the schedule (only if valid)
  3. Detect out-of-range values in all cron expression fields
  4. Provide clear, helpful error messages that explain which field is invalid and why

Test Cases

  • Validating the expression "* * * * *" returns isValid: true with a description of the schedule @test
  • Validating the expression "65 * * * *" returns isValid: false with an error message indicating the minute field is out of range @test
  • Validating the expression "0 25 * * *" returns isValid: false with an error message indicating the hour field is out of range @test
  • Validating the expression "0 0 32 * *" returns isValid: false with an error message indicating the day-of-month field is out of range @test
  • Validating the expression "30 14 1 * *" returns isValid: true with a description of the schedule @test

Implementation

@generates

API

/**
 * Validates a cron expression and provides feedback
 * @param {string} expression - The cron expression to validate
 * @returns {{isValid: boolean, errorMessage?: string, description?: string}} Validation result
 */
function validateCronExpression(expression) {
  // IMPLEMENTATION HERE
}

module.exports = { validateCronExpression };

Dependencies { .dependencies }

cronstrue { .dependency }

Provides cron expression parsing and validation support.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/cronstrue@3.2.x
tile.json