5.0.4 • Published 29 days ago

@hebcal/rest-api v5.0.4

Weekly downloads
27
License
BSD-2-Clause
Repository
github
Last release
29 days ago

@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

Typedefs

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
firstSentencebooleanfalse

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
leyningbooleantrue

eventToClassicApiObject(ev, options, leyning) ⇒ Object

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

Kind: global function

ParamTypeDefault
evEvent
optionsCalOptions
leyningbooleantrue

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
5.0.4

29 days ago

5.0.3

3 months ago

5.0.2

5 months ago

5.0.1

5 months ago

4.5.8

5 months ago

4.5.7

7 months ago

4.5.4

7 months ago

4.5.3

8 months ago

4.5.6

7 months ago

4.5.5

7 months ago

5.0.0

5 months ago

4.5.2

8 months ago

4.5.1

12 months ago

4.5.0

1 year ago

4.4.1

1 year ago

4.4.0

1 year ago

4.4.2

1 year ago

4.3.9

1 year ago

4.3.6

1 year ago

4.3.8

1 year ago

4.3.7

1 year ago

4.3.13

1 year ago

4.3.12

1 year ago

4.3.11

1 year ago

4.3.10

1 year ago

4.3.15

1 year ago

4.3.14

1 year ago

4.3.5

2 years ago

4.3.2

2 years ago

4.3.4

2 years ago

4.3.3

2 years ago

4.0.0

2 years ago

4.2.0

2 years ago

4.3.1

2 years ago

4.1.0

2 years ago

4.3.0

2 years ago

3.19.4

2 years ago

3.19.3

2 years ago

3.19.5

2 years ago

3.19.0

2 years ago

3.19.2

2 years ago

3.19.1

2 years ago

3.15.0

2 years ago

3.17.0

2 years ago

3.15.1

2 years ago

3.14.1

2 years ago

3.14.0

2 years ago

3.16.0

2 years ago

3.18.0

2 years ago

3.13.2

2 years ago

3.13.0

2 years ago

3.12.0

2 years ago

3.10.1

2 years ago

3.10.0

2 years ago

3.10.2

2 years ago

3.9.0

2 years ago

3.8.7

2 years ago

3.8.6

3 years ago

3.8.5

3 years ago

3.8.4

3 years ago

3.8.3

3 years ago

3.8.2

3 years ago

3.8.1

3 years ago

3.8.0

3 years ago

3.7.2

3 years ago

3.7.0

3 years ago

3.6.0

3 years ago

3.5.0

3 years ago

3.4.5

3 years ago

3.4.0

3 years ago

3.4.4

3 years ago

3.4.3

3 years ago

3.3.4

3 years ago

3.4.2

3 years ago

3.4.1

3 years ago

3.3.3

3 years ago

3.3.1

3 years ago

3.3.2

3 years ago

3.3.0

3 years ago

3.2.0

3 years ago

3.1.0

3 years ago

3.0.0

3 years ago

2.8.1

3 years ago

2.8.0

3 years ago

2.7.2

4 years ago

2.7.1

4 years ago

2.7.0

4 years ago

2.6.0

4 years ago

2.5.0

4 years ago

2.4.1

4 years ago

2.4.0

4 years ago

2.3.4

4 years ago

2.3.3

4 years ago

2.3.2

4 years ago

2.3.1

4 years ago

2.3.0

4 years ago

2.2.5

4 years ago

2.2.6

4 years ago

2.2.4

4 years ago

2.2.3

4 years ago

2.2.1

4 years ago

2.2.2

4 years ago

2.2.0

4 years ago

2.1.5

4 years ago

2.1.4

4 years ago

2.1.3

4 years ago

2.1.2

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.3

4 years ago