@kovalenko/is-cron
TypeScript icon, indicating that this package has built-in type declarations

1.0.10 • Public • Published

IsCron

Typescript property decorator for the crontab config validation

Installation

npm install @kovalenko/is-cron

Usage

function IsCron(): PropertyDecorator;
function IsCron(options: InputOptions): PropertyDecorator;
function IsCron(options: ValidationOptions): PropertyDecorator;
function IsCron(cronOptions: InputOptions, options: ValidationOptions): PropertyDecorator;

Basic

import {IsCron} from '@kovalenko/is-cron';

export class Foo {

  @IsCron()
  bar: string;
}

With InputOptions

import {IsCron} from '@kovalenko/is-cron';
import {InputOptions} from 'cron-validate/lib/types';

const cronOptions: InputOptions = {
  override: {
    useSeconds: true,
  },
};

export class Foo {

  @IsCron(cronOptions)
  baz: string[];
}

With ValidationOptions

import {IsCron} from '@kovalenko/is-cron';

export class Foo {

  @IsCron({each: true})
  baz: string[];
}

With InputOptions and ValidationOptions

import {IsCron} from '@kovalenko/is-cron';
import {InputOptions} from 'cron-validate/lib/types';

const cronOptions: InputOptions = {
  override: {
    useSeconds: true,
  },
};

export class Foo {

  @IsCron(cronOptions, {each: true})
  baz: string[];
}

Package Sidebar

Install

npm i @kovalenko/is-cron

Weekly Downloads

2,130

Version

1.0.10

License

MIT

Unpacked Size

39.8 kB

Total Files

14

Last publish

Collaborators

  • kovalenko