Socket
Socket
Sign inDemoInstall

@hebcal/rest-api

Package Overview
Dependencies
5
Maintainers
1
Versions
110
Alerts
File Explorer

Advanced tools

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
37
decreased by-26%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

@hebcal/rest-api

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

Build Status

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

locationToPlainObj(location)LocationPlainObj

Converts a @hebcal/core Location to a plain JS object.

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
pad4(number)string
toISOString(d)string

Returns just the date portion as YYYY-MM-DD

getEventCategories(ev)Array.<string>

Returns a category and subcategory name

renderTitleWithoutTime(ev)string

Renders the event title in default locale, but strips off time

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

makeTorahMemoText(ev, il)string

Makes mulit-line text that summarizes Torah & Haftarah

appendIsraelAndTracking(url, il, utmSource, utmMedium, utmCampaign)string

Appends utm_source and utm_medium parameters to a URL

eventToCsv(e, options)string

Renders an Event as a string

eventsToCsv(events, options)string
eventsToClassicApi(events, options, [leyning])Object

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

eventToClassicApiObject(ev, options, [leyning])Object

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

formatAliyot(result, aliyot)Object
formatLeyningResult(reading)Object
eventsToRss2(events, options)string
eventToRssItem2(ev, options)string
eventToFullCalendar(ev, tzid, il)Object

Converts a Hebcal event to a FullCalendar.io object

Typedefs

LocationPlainObj : Object

Location information

locationToPlainObj(location) ⇒ LocationPlainObj

Converts a @hebcal/core Location to a plain JS object.

Kind: global function

ParamType
locationLocation

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
optionsCalOptions

pad2(number) ⇒ string

Kind: global function

ParamType
numbernumber

pad4(number) ⇒ string

Kind: global function

ParamType
numbernumber

toISOString(d) ⇒ string

Returns just the date portion as YYYY-MM-DD

Kind: global function

ParamType
dDate

getEventCategories(ev) ⇒ Array.<string>

Returns a category and subcategory name

Kind: global function

ParamType
evEvent

renderTitleWithoutTime(ev) ⇒ string

Renders the event title in default locale, but strips off time

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>
optionsCalOptions

getHolidayDescription(ev, [firstSentence]) ⇒ string

Returns an English language description of the holiday

Kind: global function

ParamTypeDefault
evEvent
[firstSentence]booleanfalse

makeTorahMemoText(ev, il) ⇒ string

Makes mulit-line text that summarizes Torah & Haftarah

Kind: global function

ParamType
evEvent
ilboolean

appendIsraelAndTracking(url, il, utmSource, utmMedium, utmCampaign) ⇒ string

Appends utm_source and utm_medium parameters to a URL

Kind: global function

ParamType
urlstring
ilboolean
utmSourcestring
utmMediumstring
utmCampaignstring

eventToCsv(e, options) ⇒ string

Renders an Event as a string

Kind: global function

ParamType
eEvent
optionsCalOptions

eventsToCsv(events, options) ⇒ string

Kind: global function

ParamType
eventsArray.<Event>
optionsHebcalOptions

eventsToClassicApi(events, options, [leyning]) ⇒ Object

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

Kind: global function

ParamTypeDefault
eventsArray.<Event>
optionsCalOptions
[leyning]booleantrue

eventToClassicApiObject(ev, options, [leyning]) ⇒ Object

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

Kind: global function

ParamTypeDefault
evEvent
optionsCalOptions
[leyning]booleantrue

formatAliyot(result, aliyot) ⇒ Object

Kind: global function

ParamType
resultObject
aliyotObject

formatLeyningResult(reading) ⇒ Object

Kind: global function

ParamType
readingLeyning

eventsToRss2(events, options) ⇒ string

Kind: global function

ParamType
eventsArray.<Event>
optionsCalOptions

eventToRssItem2(ev, options) ⇒ string

Kind: global function

ParamType
evEvent
optionsCalOptions

eventToFullCalendar(ev, tzid, il) ⇒ Object

Converts a Hebcal event to a FullCalendar.io object

Kind: global function

ParamTypeDescription
evEvent
tzidstringtimeZone identifier
ilbooleantrue if Israel

LocationPlainObj : Object

Location information

Kind: global typedef
Properties

NameType
titlestring
citystring
tzidstring
latitudenumber
longitudenumber
ccstring
countrystring
admin1string
asciinamestring
geostring
zipstring
statestring
stateNamestring
geonameidnumber

Keywords

FAQs

Last updated on 02 Apr 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc