Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@ordermentum/lunartick
Advanced tools
[![npm version](https://badge.fury.io/js/lunartick.svg)](https://badge.fury.io/js/lunartick) [![Build Status](https://travis-ci.org/ordermentum/lunartick.svg?branch=master)](https://travis-ci.org/ordermentum/lunartick) [![npm](https://img.shields.io/npm/l
Based on the RFC5545 spec for Internet Calendaring and Scheduling Core Object Specification.
Lunartick!! ... get it!?
It's a pun on lunar and a crazy person, because that's what I feel like after working on this. It's a joke.
Anyway...
Lunartick allows you to parse an RRULE string to return an object of the properties in JS format. The returned object has an iterator() 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
[![npm version](https://badge.fury.io/js/lunartick.svg)](https://badge.fury.io/js/lunartick) [![Build Status](https://travis-ci.org/ordermentum/lunartick.svg?branch=master)](https://travis-ci.org/ordermentum/lunartick) [![npm](https://img.shields.io/npm/l
The npm package @ordermentum/lunartick receives a total of 349 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.