New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

crons

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crons

This is a collection of cron expressions

latest
Source
npmnpm
Version
1.1.1-alpha.0
Version published
Maintainers
1
Created
Source

cron 表达式

翻译能力

能够把 cron 字符串翻译为可描述语言

入参:字符串、配置项

出参:可描述语言|cron 表达式不合法

配置项:翻译模板配置

校验能力

能够校验 cron 表达式是否正确,返回 true(正确)、false(不是 cron 表达式)、object(部分频率错误)

转换能力

能够把 cron 字符串转换为可识别的对象,可识别对象转换为 cron 表达式

输入 cron 表达式=>检查是否为正确的 cron 表达式,如果正确?自动识别类型=>输出可识别对象:返回 false

输入可识别对象=>检查是否为正确的 cron 表达式,如果正确?自动识别类型=>输出 cron 表达式:返回 false

正确的 cron 表达式规则

5、6、7 个字符串,如* * * * ** * * * * ?* * * * * ? *

正确的对象

{
  //值范围:0-59
  "second": {
    "isCommon": false,
    "list": ["1", { "start": "0", "end": "59", "step": "" }]
  },
  //值范围:0-59
  "minute": {
    "isCommon": true,
    "list": undefined
  },
  //值范围:0-23
  "hour": "",
  //值范围:1-31
  "day": "",
  //值范围:1-12
  "moth": "",
  //值范围:0-6 1-7
  "week": "",
  //值范围:1970-2090
  "year": ""
}

其他库: cron-parser、cronstrue

FAQs

Package last updated on 25 Jul 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