CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-cronstrue

Convert cron expressions into human readable descriptions

Overall
score

100%

Overview
Eval results
Files

task.mdevals/scenario-3/

Internationalized Schedule Formatter

Build a schedule description utility that converts cron expressions into human-readable descriptions in multiple languages, with an understanding of bundle size optimization.

Requirements

Your utility should provide a main function that:

  1. Accepts a cron schedule expression and a language code as input
  2. Returns a human-readable description of the schedule in the specified language
  3. Handles invalid or unsupported language codes gracefully

The implementation should demonstrate awareness of bundle size considerations when working with multiple language support.

Functionality

  • Convert cron expressions to human-readable text
  • Support at least three languages: English (en), French (fr), and Spanish (es)
  • Fall back to English for unsupported locales
  • Provide clear, natural language descriptions of schedules

Implementation

@generates

API

/**
 * Formats a cron expression into a human-readable description in the specified language
 * @param {string} cronExpression - The cron expression to describe (e.g., "0 9 * * *")
 * @param {string} locale - The language code (e.g., 'en', 'fr', 'es')
 * @returns {string} Human-readable description of the schedule
 */
function describeSchedule(cronExpression, locale) {
  // IMPLEMENTATION HERE
}

module.exports = { describeSchedule };

Test Cases

  • Describing "0 9 * * *" in English returns a morning schedule description @test
  • Describing "0 9 * * *" in French returns a French morning schedule description @test
  • Describing "0 9 * * *" in Spanish returns a Spanish morning schedule description @test
  • Describing "*/15 * * * *" in English returns an interval description @test
  • Using an unsupported locale like German falls back to English @test

Dependencies { .dependencies }

cronstrue { .dependency }

A JavaScript library for converting cron expressions into human-readable descriptions with internationalization support.

Notes

When implementing multi-language support:

  • Consider the impact of including all available languages versus only the languages you need
  • Think about how different loading approaches affect the final bundle size
  • Ensure your implementation is efficient for production use

Install with Tessl CLI

npx tessl i tessl/npm-cronstrue

tile.json