Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cron-validator

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cron-validator

Validates cron expressions

  • 1.3.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
214K
decreased by-10.06%
Maintainers
2
Weekly downloads
 
Created

What is cron-validator?

The cron-validator npm package is used to validate and parse cron expressions. It ensures that cron expressions are syntactically correct and can be used to schedule tasks in a reliable manner.

What are cron-validator's main functionalities?

Validate Cron Expression

This feature allows you to validate a cron expression to check if it is syntactically correct. The `isValidCron` function returns a boolean indicating whether the provided cron expression is valid.

const cronValidator = require('cron-validator');

const isValid = cronValidator.isValidCron('0 0 * * *');
console.log(isValid); // true

Custom Validation Options

This feature allows you to validate a cron expression with custom options. For example, you can specify whether to include seconds in the cron expression or allow blank days.

const cronValidator = require('cron-validator');

const options = { seconds: true, allowBlankDay: true };
const isValid = cronValidator.isValidCron('0 0 0 * * *', options);
console.log(isValid); // true

Parse Cron Expression

This feature allows you to parse a cron expression into its individual components. The `parseCron` function returns an object with the parsed components of the cron expression.

const cronValidator = require('cron-validator');

const parsed = cronValidator.parseCron('0 0 * * *');
console.log(parsed); // { minutes: '0', hours: '0', dayOfMonth: '*', months: '*', dayOfWeek: '*' }

Other packages similar to cron-validator

Keywords

FAQs

Package last updated on 20 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc