Socket
Socket
Sign inDemoInstall

@hebcal/rest-api

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hebcal/rest-api

Jewish holidays and Hebrew calendar as plain JSON objects and CSV export


Version published
Weekly downloads
55
decreased by-39.56%
Maintainers
1
Weekly downloads
 
Created
Source

hebcal-rest-api

Jewish holidays and Hebrew calendar as plain JSON objects, RSS, and CSV export

Installation

$ npm install @hebcal/rest-api

Synopsis

import {HebrewCalendar, Location} from '@hebcal/core';
import {eventsToClassicApi, eventsToCsv} from '@hebcal/rest-api';

const options = {
  year: 2020,
  month: 2,
  sedrot: true,
  candlelighting: true,
  location: Location.lookup('Hawaii'),
};
const events = HebrewCalendar.calendar(options);
const apiResult = eventsToClassicApi(events, options);

console.log(JSON.stringify(apiResult));

const csv = eventsToCsv(events, options);
console.log(JSON.stringify(csv));

Functions

getFormatter(tzid)Intl.DateTimeFormat
getPseudoISO(tzid, date)string
getTimezoneOffset(tzid, date)number
makeAnchor(s)string

Helper function to transform a string to make it more usable in a URL or filename. Converts to lowercase and replaces non-word characters with hyphen ('-').

getDownloadFilename(options)string
pad2(number)string
timeZoneOffsetStr(tzid, date)string

Get offset string (like "+05:00" or "-08:00") from tzid (like "Europe/Moscow")

toISOString(d)string

Returns just the date portion as YYYY-MM-DD

toISOStringWithTimezone(date, timeStr, tzid)string

Returns a string like "2018-09-01T12:30:00-05:00'"

getEventCategories(ev)Array.<string>

Returns a category and subcategory name

getCalendarTitle(events, options)string

Generates a title like "Hebcal 2020 Israel" or "Hebcal May 1993 Providence"

getHolidayDescription(ev, [firstSentence])string

Returns an English language description of the holiday

eventToCsv(e, options)string

Renders an Event as a string

eventsToCsv(events, options)string
eventsToClassicApi(events, options)Object

Formats a list events for the classic Hebcal.com JSON API response

eventToClassicApiObject(ev, tzid, il)Object

Converts a Hebcal event to a classic Hebcal.com JSON API object

formatAliyot(result, aliyot)Object
formatLeyningResult(reading)Object
getLinkAndGuid(ev)Array.<string>
eventsToRss(events, location, [lang], [evPubDate])string
eventToRssItem(ev, evPubDate, lastBuildDate, dayFormat, location)string
eventToFullCalendar(ev, tzid, il)Object

Converts a Hebcal event to a FullCalendar.io object

getFormatter(tzid) ⇒ Intl.DateTimeFormat

Kind: global function

ParamType
tzidstring

getPseudoISO(tzid, date) ⇒ string

Kind: global function

ParamType
tzidstring
dateDate

getTimezoneOffset(tzid, date) ⇒ number

Kind: global function

ParamType
tzidstring
dateDate

makeAnchor(s) ⇒ string

Helper function to transform a string to make it more usable in a URL or filename. Converts to lowercase and replaces non-word characters with hyphen ('-').

Kind: global function

ParamType
sstring

Example

makeAnchor('Rosh Chodesh Adar II') // 'rosh-chodesh-adar-ii'

getDownloadFilename(options) ⇒ string

Kind: global function

ParamType
optionsHebrewCalendar.Options

pad2(number) ⇒ string

Kind: global function

ParamType
numbernumber

timeZoneOffsetStr(tzid, date) ⇒ string

Get offset string (like "+05:00" or "-08:00") from tzid (like "Europe/Moscow")

Kind: global function

ParamType
tzidstring
dateDate

toISOString(d) ⇒ string

Returns just the date portion as YYYY-MM-DD

Kind: global function

ParamType
dDate

toISOStringWithTimezone(date, timeStr, tzid) ⇒ string

Returns a string like "2018-09-01T12:30:00-05:00'"

Kind: global function

ParamTypeDescription
dateDate
timeStrstringmust be formatted with only hours and minutes, like "17:12"
tzidstringlike "America/New_York"

getEventCategories(ev) ⇒ Array.<string>

Returns a category and subcategory name

Kind: global function

ParamType
evEvent

getCalendarTitle(events, options) ⇒ string

Generates a title like "Hebcal 2020 Israel" or "Hebcal May 1993 Providence"

Kind: global function

ParamType
eventsArray.<Event>
optionsHebrewCalendar.Options

getHolidayDescription(ev, [firstSentence]) ⇒ string

Returns an English language description of the holiday

Kind: global function

ParamTypeDefault
evEvent
[firstSentence]booleanfalse

eventToCsv(e, options) ⇒ string

Renders an Event as a string

Kind: global function

ParamType
eEvent
optionsHebcalOptions

eventsToCsv(events, options) ⇒ string

Kind: global function

ParamType
eventsArray.<Event>
optionsHebcalOptions

eventsToClassicApi(events, options) ⇒ Object

Formats a list events for the classic Hebcal.com JSON API response

Kind: global function

ParamType
eventsArray.<Event>
optionsHebcalOptions

eventToClassicApiObject(ev, tzid, il) ⇒ Object

Converts a Hebcal event to a classic Hebcal.com JSON API object

Kind: global function

ParamTypeDescription
evEvent
tzidstringtimeZone identifier
ilbooleantrue if Israel

formatAliyot(result, aliyot) ⇒ Object

Kind: global function

ParamType
resultObject
aliyotObject

formatLeyningResult(reading) ⇒ Object

Kind: global function

ParamType
readingleyning.Leyning

getLinkAndGuid(ev) ⇒ Array.<string>

Kind: global function

ParamType
evEvent

eventsToRss(events, location, [lang], [evPubDate]) ⇒ string

Kind: global function

ParamTypeDescription
eventsArray.<Event>
locationLocation
[lang]stringlanguage such as 'he' (default 'en-US')
[evPubDate]booleanif true, use event time as pubDate (false uses lastBuildDate)

eventToRssItem(ev, evPubDate, lastBuildDate, dayFormat, location) ⇒ string

Kind: global function

ParamType
evEvent
evPubDateboolean
lastBuildDatestring
dayFormatIntl.DateTimeFormat
locationLocation

eventToFullCalendar(ev, tzid, il) ⇒ Object

Converts a Hebcal event to a FullCalendar.io object

Kind: global function

ParamTypeDescription
evEvent
tzidstringtimeZone identifier
ilbooleantrue if Israel

Keywords

FAQs

Package last updated on 07 Jul 2020

Did you know?

Socket

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.

Install

Related posts

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