Socket
Socket
Sign inDemoInstall

@hebcal/icalendar

Package Overview
Dependencies
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hebcal/icalendar - npm Package Compare versions

Comparing version 3.2.1 to 3.3.0

50

dist/index.js

@@ -8,3 +8,2 @@ 'use strict';

var fs = require('fs');
var stream = require('stream');

@@ -350,3 +349,3 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var version="3.2.1";
var version="3.3.0";

@@ -611,12 +610,13 @@ const VTIMEZONE = {};

/**
* Generates an RFC 2445 iCalendar stream from an array of events
* @param {NodeJS.ReadableStream} stream
* Generates an RFC 2445 iCalendar string from an array of events
* @param {Event[]} events
* @param {HebrewCalendar.Options} options
* @return {string}
*/
async function eventsToIcalendarStream(stream, events, options) {
async function eventsToIcalendar(events, options) {
if (!events.length) throw new RangeError('Events can not be empty');
if (!options) throw new TypeError('Invalid options object');
const stream = [];
const uclang = core.Locale.getLocaleName().toUpperCase();

@@ -646,5 +646,7 @@ const title = options.title ? icalEscapeStr(options.title) : getCalendarTitle_1(events, options);

} else {
const vtimezoneFilename = `./zoneinfo/${tzid}.ics`;
try {
const vtimezoneIcs = `./zoneinfo/${tzid}.ics`;
const lines = await fs.promises.readFile(vtimezoneIcs, 'utf-8').split('\r\n'); // ignore first 3 and last 1 lines
const vtimezoneIcs = await fs.promises.readFile(vtimezoneFilename, 'utf-8');
const lines = vtimezoneIcs.split('\r\n'); // ignore first 3 and last 1 lines

@@ -673,39 +675,7 @@ const str = lines.slice(3, lines.length - 2).join('\r\n');

stream.push('END:VCALENDAR\r\n');
stream.push(null);
return stream.join('');
}
/**
* @private
* @param {stream.Readable} readable
* @return {string}
*/
async function readableToString(readable) {
let result = '';
for await (const chunk of readable) {
result += chunk;
}
return result;
}
/**
* Renders an array of events as a full RFC 2445 iCalendar string
* @param {Event[]} events
* @param {HebrewCalendar.Options} options
* @return {string} multi-line result, delimited by \r\n
*/
async function eventsToIcalendar(events, options) {
const readStream = new stream.Readable();
await eventsToIcalendarStream(readStream, events, options);
readStream.on('error', err => {
throw err;
});
return readableToString(readStream);
}
exports.IcalEvent = IcalEvent;
exports.eventToIcal = eventToIcal;
exports.eventsToIcalendar = eventsToIcalendar;
exports.eventsToIcalendarStream = eventsToIcalendarStream;

4

package.json
{
"name": "@hebcal/icalendar",
"version": "3.2.1",
"version": "3.3.0",
"author": "Michael J. Radwin (https://github.com/mjradwin)",

@@ -26,3 +26,3 @@ "keywords": [

"dependencies": {
"@hebcal/core": "^2.8.0",
"@hebcal/core": "^2.8.1",
"@hebcal/rest-api": "^2.8.1"

@@ -29,0 +29,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc