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

@hebcal/rest-api

v5.0.4

Published

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

Downloads

341

Readme

@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

| Param | Type | | --- | --- | | location | Location |

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

| Param | Type | | --- | --- | | s | string |

Example

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

getDownloadFilename(options) ⇒ string

Kind: global function

| Param | Type | | --- | --- | | options | CalOptions |

pad2(number) ⇒ string

Kind: global function

| Param | Type | | --- | --- | | number | number |

pad4(number) ⇒ string

Kind: global function

| Param | Type | | --- | --- | | number | number |

toISOString(d) ⇒ string

Returns just the date portion as YYYY-MM-DD

Kind: global function

| Param | Type | | --- | --- | | d | Date |

getEventCategories(ev) ⇒ Array.<string>

Returns a category and subcategory name

Kind: global function

| Param | Type | | --- | --- | | ev | Event |

renderTitleWithoutTime(ev) ⇒ string

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

Kind: global function

| Param | Type | | --- | --- | | ev | Event |

getCalendarTitle(events, options) ⇒ string

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

Kind: global function

| Param | Type | | --- | --- | | events | Array.<Event> | | options | CalOptions |

getHolidayDescription(ev, [firstSentence]) ⇒ string

Returns an English language description of the holiday

Kind: global function

| Param | Type | Default | | --- | --- | --- | | ev | Event | | | [firstSentence] | boolean | false |

makeTorahMemoText(ev, il) ⇒ string

Makes mulit-line text that summarizes Torah & Haftarah

Kind: global function

| Param | Type | | --- | --- | | ev | Event | | il | boolean |

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

Appends utm_source and utm_medium parameters to a URL

Kind: global function

| Param | Type | | --- | --- | | url | string | | il | boolean | | utmSource | string | | utmMedium | string | | utmCampaign | string |

eventToCsv(e, options) ⇒ string

Renders an Event as a string

Kind: global function

| Param | Type | | --- | --- | | e | Event | | options | CalOptions |

eventsToCsv(events, options) ⇒ string

Kind: global function

| Param | Type | | --- | --- | | events | Array.<Event> | | options | HebcalOptions |

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

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

Kind: global function

| Param | Type | Default | | --- | --- | --- | | events | Array.<Event> | | | options | CalOptions | | | [leyning] | boolean | true |

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

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

Kind: global function

| Param | Type | Default | | --- | --- | --- | | ev | Event | | | options | CalOptions | | | [leyning] | boolean | true |

formatAliyot(result, aliyot) ⇒ Object

Kind: global function

| Param | Type | | --- | --- | | result | Object | | aliyot | Object |

formatLeyningResult(reading) ⇒ Object

Kind: global function

| Param | Type | | --- | --- | | reading | Leyning |

eventsToRss2(events, options) ⇒ string

Kind: global function

| Param | Type | | --- | --- | | events | Array.<Event> | | options | CalOptions |

eventToRssItem2(ev, options) ⇒ string

Kind: global function

| Param | Type | | --- | --- | | ev | Event | | options | CalOptions |

eventToFullCalendar(ev, tzid, il) ⇒ Object

Converts a Hebcal event to a FullCalendar.io object

Kind: global function

| Param | Type | Description | | --- | --- | --- | | ev | Event | | | tzid | string | timeZone identifier | | il | boolean | true if Israel |

LocationPlainObj : Object

Location information

Kind: global typedef
Properties

| Name | Type | | --- | --- | | title | string | | city | string | | tzid | string | | latitude | number | | longitude | number | | cc | string | | country | string | | admin1 | string | | asciiname | string | | geo | string | | zip | string | | state | string | | stateName | string | | geonameid | number |