Skip to content

Repository files navigation

ical-utils

A tiny collection of helpers for obtaining and processing iCal feeds in JS.

Usage

This isn't currently published to NPM but you can require it by using a Git url style reference in your package.json:

npm install --save https://github.com/edwardsnjd/ical-utils

Then require and use the utils:

const {map,filter} = require('lodash/fp');
const {getCalendar,filters,transforms,getCalendar,utils} = require('ical-utils');

const CALENDAR_URL = 'https://www.nasa.gov/templateimages/redesign/calendar/iCal/nasa_calendar.ics';

getCalendar(CALENDAR_URL)
    .then(filter(filters.summaryMatchesRegex(/^Interesting/i)))
    .then(map(transforms.selectSummary))
    .then(map(transforms.fieldsToMoments('start', 'end')))
    .then(map(transforms.addDurationInHours))
    .then(utils.tapLog);

API

The functions are exposed in groups:

const icalUtils = require('ical-utils');
// icalUtils
//    .getCalendar = () => {...}
//    .getCalendarFile = () => {...}
//    .filters = {...}
//    .transforms = {...}
//    .utils = {...}

View the source for details of these areas.

Docker

The Dockerfile defines an opinionated script to convert iCal from stdin to JSON on stdout.

Build it: docker build --tag ical-to-json .

Run it: < foo.ics docker run --rm ical-to-json

About

Simple utilities for dealing with iCal feeds in JS

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages