1.0.1 • Published 3 years ago

@typedninja/pullable-cron v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@typedninja/pullable-cron

Cron transformations for @typedninja/pullable

Install

$ yarn add @typedninja/pullable-cron

$ npm install --save @typedninja/pullable-cron

Usage

Provides the cron transformer which allows you to delay and repeat iteration by providing a cron-like expression.

Also see the API documentation.

import { from } from "@typedninja/pullable";
import { cron } from "@typedninja/pullable-cron";

const cronified = from([ 1, 2, 3, 4 ]).pipe(
  cron("* * * * * *"),
);

for await (const num of cronified) {
  console.log(num);
}

This transformer uses cron-parser under the hood and like that module also accepts an options parameter. See the cron-parser documentation for more information about allowed options.

const cronified = from([ 1, 2, 3, 4 ]).pipe(
  cron("* * * * * *", { currentDate: new Date() }),
);

License

MIT

See also