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

cal-parser

v1.0.2

Published

JavaScript/Node library to parse iCal (.ics) files with few dependencies

Downloads

11,526

Readme

cal-parser

What does it do?

cal-parser parses a .ics file into a more-easily-usable JavaScript object.

This package can also be found on npm

Why use this over Mozilla's ical?

I wanted to have this functionality in React Native, but unfortunately ical uses Node native packages. This version does not use Node standard library packages for its functionality, so it should be usable on any JavaScript/Node platform.

Features

  • [x] Parses large ical strings.
  • [x] Should be able to handle any parameters, including custom.
  • [x] Automatically transforms dates and date-times into JS Date objects, if applicable.
  • [x] Very few dependencies, giving it good compatibility.

To-Do

(Help is appreciated!)

  • [ ] Optimize the parser. (I threw this together quickly and JS is not my best language)
  • [ ] Ensure/Test Full RFC-5545 Compliance.
  • [ ] Add sorting the list by criteria.

Usage

const ical = require('cal-parser');
const fs = require("fs");

const myCalendarString = fs.readFileSync("./test/ical/mine/test.ics", "utf-8");

const parsed = ical.parseString(myCalendarString);

// Read Calendar Metadata
console.log(parsed.calendarData);

// Read Events
console.log(parsed.events);

Example

This:

BEGIN:VEVENT
DTSTART:20180917T220000Z
DTEND:20180917T230000Z
DTSTAMP:20190411T013638Z
ORGANIZER;CN=Jordan Quinones:mailto:[email protected]
UID:6di62pj26dgmcbb360pj0b9k64sm4b9pckojcb9l64sm8phjc8p3gchhc4@google.com
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;CN=presid
 [email protected];X-NUM-GUESTS=0:mailto:[email protected]
CREATED:20180913T213925Z
DESCRIPTION:Sheraton San Diego Hotel & Marina\nSan Diego\n+1 619-291-2900\n
 \n97766036\n97766043\n\nCheck-in: Apr 11\, 2019 4:00pm\nCheck-out: Apr 13\,
  2019 12:00pm
LAST-MODIFIED:20180916T173634Z
LOCATION:Associated Students\, 5500 Campanile Dr #320\, San Diego\, CA 9218
 2\, USA
SEQUENCE;TESTPARAM=TESTPARAM:0
STATUS:CONFIRMED
SUMMARY:Meet up with Panhellenic\, CPA
TRANSP:OPAQUE
END:VEVENT

Turns into this:

{
  "dtstart": {
    "value": "2018-09-17T22:00:00.000Z"
  },
  "dtend": {
    "value": "2018-09-17T23:00:00.000Z"
  },
  "dtstamp": "2019-04-11T01:36:38.000Z",
  "organizer": {
    "value": "mailto:[email protected]",
    "params": {
      "cn": "Jordan Quinones"
      }
    },
  "uid": {
    "value":
      "6di62pj26dgmcbb360pj0b9k64sm4b9pckojcb9l64sm8phjc8p3gchhc4@google.com"
    },
  "attendee": {
    "value": "mailto:[email protected]",
    "params": {
      "cutype": "INDIVIDUAL",
      "role": "REQ-PARTICIPANT",
      "partstat": "ACCEPTED",
      "cn": "[email protected]",
      "x-num-guests": "0"
     }
  },
  "created": "2018-09-13T21:39:25.000Z",
  "description": {
    "value":
      "Sheraton San Diego Hotel & Marina San Diego +1 619-291-2900 97766036 97766043 Check-in: Apr 11, 2019 4:00pm Check-out: Apr 13, 2019 12:00pm"
  },
  "last-modified": "2018-09-16T17:36:34.000Z",
  "location": {
    "value":
      "Associated Students, 5500 Campanile Dr #320, San Diego, CA 92182, USA"
  },
  "sequence": {
    "value": "0",
    "params": {
      "testparam": "TESTPARAM"
    }
  },
  "status": {
    "value": "CONFIRMED"
  },
  "summary": {
    "value": "Meet up with Panhellenic, CPA"
  },
  "transp": {
    "value": "OPAQUE"
  }
}