npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

icalevent

v0.3.2

Published

Create an iCalEvent instance by setting limited properties and get an ics formatted string.

Downloads

703

Readme

iCalEvent

Create an iCalEvent instance by setting limited properties and event.toFile() to get an ics formatted string back.

Install

With npm:

npm install icalevent

Examples

var iCalEvent = require('icalevent');

var event = new iCalEvent({
	uid: 9873647,
	offset: new Date().getTimezoneOffset(),
	method: 'request',
	status: 'confirmed',
	attendees: [
		{
			name: 'Johnny Boy',
			email: '[email protected]'
		},
		{
			name: 'Homer Simpson',
			email: '[email protected]'
		}
	],
	start: '2014-07-01T02:00:00-05:00',
	end: '2014-07-01T02:30:00-05:00',
	timezone: 'US/Central',
	summary: 'Priestly Duties',
	description: 'Home flu visit.',
	location: 'Casa',
	organizer: {
		name: 'Nacho Libre',
		email: '[email protected]'
	},
	url: 'http://google.com/search?q=nacho+libre'
});

Or:

var iCalEvent = require('icalevent');

var event = new iCalEvent();

event.set('uid', 9873647);
event.set('offset', new Date().getTimezoneOffset());
event.set('method', 'request');
event.set('status', 'confirmed');
event.set('attendees', [
	{
		name: 'Johnny Boy',
		email: '[email protected]'
	},
	{
		name: 'Homer Simpson',
		email: '[email protected]'
	}
]);
event.set('start', '2014-07-01T02:00:00-05:00');
event.set('end', '2014-07-01T02:30:00-05:00');
event.set('timezone', 'US/Central');
event.set('summary', 'Priestly Duties.');
event.set('description', 'Home flu visit.');
event.set('location', 'Casa');
event.set('organizer', { name: 'Nacho Libre', email: '[email protected]' });
event.set('url', 'http://google.com/search?q=nacho+libre');

To ics string:

event.toFile();

Returns:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//iCalEvent.js v0.3//EN
BEGIN:VEVENT
UID:9873647
DTSTAMP:20140316T003036
METHOD:REQUEST
STATUS:CONFIRMED
DTSTART;TZID=US/Central:20140701T020000
DTEND;TZID=US/Central:20140701T023000
SUMMARY:Priestly Duties.
DESCRIPTION:Home flu visit.
ORGANIZER;CN=Nacho Libre:mailto:[email protected]
LOCATION:Casa
URL;VALUE=URI:http://google.com/search?q=nacho+libre
ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;CN=Johnny Boy:MAILTO:[email protected]
ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;CN=Homer Simpson:MAILTO:[email protected]
END:VEVENT
END:VCALENDAR

API

Properties

Required

  • offset (Integer) The Date.getTimezoneOffset() of the timezone the event is set in. Important: the offset has to be set before start and end times
  • start (Date Object) The start date object of the event
  • end (Date Object) The end date object of the event

Optional

  • uid (String or Integer) The event uid. If you don't set the uid it will be set for you.
  • method (String) The event method. For example, publish, request, reply, add, cancel, refresh, counter, and decline-counter
  • status (String) The event status. For example, cancelled, confirmed, tentative
  • timezone (String) The event's timezone in ICS timezone format. If you don't set the timezone it will be set for you.
  • location (String) The event location of the event. For example, monastery
  • url (String) A url corresponding to the event
  • summary (String) A summary of the event
  • description (String) A description of the event
  • organizer (Object) The organizer object in the following format:
{
	name: 'Nacho Libre',
	email: '[email protected]'
}
  • attendees (Array) The attendees array in the following format:
[
	{
		name: 'Johnny Boy',
		email: '[email protected]'
	},
	{
		name: 'Homer Simpson',
		email: '[email protected]'
	}
]

Methods

.set(property, value)

event.set('url', 'http://google.com/search?q=nacho+libre');

.get(property)

event.get('url');

Returns:

http://google.com/search?q=nacho+libre

.toFile()

event.toFile();

Returns:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//iCalEvent.js v0.3//EN
BEGIN:VEVENT
UID:9873647
DTSTAMP:20140316T003036
METHOD:REQUEST
STATUS:CONFIRMED
DTSTART;TZID=US/Central:20140701T020000
DTEND;TZID=US/Central:20140701T023000
SUMMARY:Priestly Duties.
DESCRIPTION:Home flu visit.
ORGANIZER;CN=Nacho Libre:mailto:[email protected]
LOCATION:Casa
URL;VALUE=URI:http://google.com/search?q=nacho+libre
ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;CN=Johnny Boy:MAILTO:[email protected]
ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;CN=Homer Simpson:MAILTO:[email protected]
END:VEVENT
END:VCALENDAR

License

MIT

Todos

  • tests