
Product
Introducing Webhook Events for Pull Request Scans
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
@ordermentum/lunartick
Advanced tools
[](https://badge.fury.io/js/lunartick) [](https://travis-ci.org/ordermentum/lunartick) [ to either get the next run time based on a start time passed in (.getNext())or over the next X
instances based on the RRULE COUNT or defaults to 1000 if no COUNT is present. If no start date is given, it will fetch the next run time based on the current time.
Please note that this package only supports ES6 friendly codebases.
NPM users
npm i lunartick
Yarn users
yarn add lunartick
Import the library and pass in an RRULE string to the .parse()
method. The resulting instance supports the following properties:
frequency, interval, count, bySetPos, byYearDay, byMonth, byMonthDay, byWeekNo, byEaster, byDay, byHour, byMinute, bySecond, tzId and dtStart.
const Rule = require('lunartick');
const rruleString = 'FREQ=DAILY;INTERVAL=1;BYHOUR=14;BYMINUTE=3;BYSECOND=0;DTSTART=19701101T020000';
const rule = Rule.parse(rruleString);
/*{
frequency: 2,
interval: 1,
byHour: [14],
byMinute: [3],
bySecond: [0],
dtStart: '19701101T020000'
}*/
Once a string has been parsed, it can be converted back to an RRULE string using the .toString()
method. This method does not take any parameters.
const string = rule.toString();
// 'FREQ=DAILY;INTERVAL=1;BYHOUR=14;BYMINUTE=3;BYSECOND=0;DTSTART=19701101T020000'
To fetch the next run time for this schedule call the .getNext()
method with an optional from date, you can pass in the .dtStart
property if you want to use it. If no from date is passed in, it will fetch the next run time base on the current time.
const nextRun = rule.getNext(rule.dtStart);
// Sun Nov 01 1970 14:03:00 GMT+1000
The rule instance will also have an iterator to fetch the next X
runtimes for the rule. You can use a for-of
loop on rule.iterator() which takes two optional parameters. The first one is the from date (default is also the current time). The second parameter is how many iterations should be fetched. If a number is passed in, it will take precedence, if a .count
property exists in the rule, it will be used next and if neither are available it will default to 52 iterations.
const iterator = rule.iterator(rule.dtStart, 5);
for (const nextDate of iterator) {
nextDate.toString();
}
// OR
Array.from(iterator);
/*
Sun Nov 01 1970 14:03:00 GMT+1000
Mon Nov 02 1970 14:03:00 GMT+1000
Tue Nov 03 1970 14:03:00 GMT+1000
Wed Nov 04 1970 14:03:00 GMT+1000
Thu Nov 05 1970 14:03:00 GMT+1000
*/
Lunartick is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.
Originally developed by Michael Cooper - Development sponsored by Ordermentum.
FAQs
[](https://badge.fury.io/js/lunartick) [](https://travis-ci.org/ordermentum/lunartick) [![npm](https://img.shields.io/npm/l
The npm package @ordermentum/lunartick receives a total of 185 weekly downloads. As such, @ordermentum/lunartick popularity was classified as not popular.
We found that @ordermentum/lunartick demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Product
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
Research
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.
Product
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.