@hebcal/core 4.1.1 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -142,6 +142,12 @@ parshiot[0] == 'Bereshit', parshiot[1] == 'Noach', parshiot[53]
142
142
  <p>When specifying years of the Hebrew calendar in the present millennium,
143
143
  we omit the thousands (which is presently 5 [ה]).</p>
144
144
  </dd>
145
+ <dt><a href="#gematriyaStrToNum">gematriyaStrToNum(str)</a> ⇒ <code>number</code></dt>
146
+ <dd><p>Converts a string of Hebrew letters to a numerical value.</p>
147
+ <p>Only considers the value of Hebrew letters <code>א</code> through <code>ת</code>.
148
+ Ignores final Hebrew letters such as <code>ך</code> (kaf sofit) or <code>ם</code> (mem sofit)
149
+ and vowels (nekudot).</p>
150
+ </dd>
145
151
  </dl>
146
152
 
147
153
  ## Typedefs
@@ -175,6 +181,8 @@ holidays. `@hebcal/core` supports four locales by default
175
181
  * [.lookupTranslation(id, [locale])](#Locale.lookupTranslation) ⇒ <code>string</code>
176
182
  * [.gettext(id, [locale])](#Locale.gettext) ⇒ <code>string</code>
177
183
  * [.addLocale(locale, data)](#Locale.addLocale)
184
+ * [.addTranslation(locale, id, translation)](#Locale.addTranslation)
185
+ * [.addTranslations(locale, data)](#Locale.addTranslations)
178
186
  * [.useLocale(locale)](#Locale.useLocale) ⇒ <code>LocaleData</code>
179
187
  * [.getLocaleName()](#Locale.getLocaleName) ⇒ <code>string</code>
180
188
  * [.getLocaleNames()](#Locale.getLocaleNames) ⇒ <code>Array.&lt;string&gt;</code>
@@ -218,6 +226,31 @@ Register locale translations.
218
226
  | locale | <code>string</code> | Locale name (i.e.: `'he'`, `'fr'`) |
219
227
  | data | <code>LocaleData</code> | parsed data from a `.po` file. |
220
228
 
229
+ <a name="Locale.addTranslation"></a>
230
+
231
+ ### Locale.addTranslation(locale, id, translation)
232
+ Adds a translation to `locale`, replacing any previous translation.
233
+
234
+ **Kind**: static method of [<code>Locale</code>](#Locale)
235
+
236
+ | Param | Type | Description |
237
+ | --- | --- | --- |
238
+ | locale | <code>string</code> | Locale name (i.e: `'he'`, `'fr'`). |
239
+ | id | <code>string</code> | Message ID to translate |
240
+ | translation | <code>string</code> | Translation text |
241
+
242
+ <a name="Locale.addTranslations"></a>
243
+
244
+ ### Locale.addTranslations(locale, data)
245
+ Adds multiple translations to `locale`, replacing any previous translations.
246
+
247
+ **Kind**: static method of [<code>Locale</code>](#Locale)
248
+
249
+ | Param | Type | Description |
250
+ | --- | --- | --- |
251
+ | locale | <code>string</code> | Locale name (i.e: `'he'`, `'fr'`). |
252
+ | data | <code>LocaleData</code> | parsed data from a `.po` file. |
253
+
221
254
  <a name="Locale.useLocale"></a>
222
255
 
223
256
  ### Locale.useLocale(locale) ⇒ <code>LocaleData</code>
@@ -311,6 +344,7 @@ Represents a Hebrew date
311
344
  * [.monthFromName(monthName)](#HDate.monthFromName) ⇒ <code>number</code>
312
345
  * [.dayOnOrBefore(dayOfWeek, absdate)](#HDate.dayOnOrBefore) ⇒ <code>number</code>
313
346
  * [.isHDate(obj)](#HDate.isHDate) ⇒ <code>boolean</code>
347
+ * [.fromGematriyaString(str, currentThousands)](#HDate.fromGematriyaString) ⇒ [<code>HDate</code>](#HDate)
314
348
 
315
349
  <a name="new_HDate_new"></a>
316
350
 
@@ -782,6 +816,24 @@ Tests if the object is an instance of `HDate`
782
816
  | --- | --- |
783
817
  | obj | <code>any</code> |
784
818
 
819
+ <a name="HDate.fromGematriyaString"></a>
820
+
821
+ ### HDate.fromGematriyaString(str, currentThousands) ⇒ [<code>HDate</code>](#HDate)
822
+ Construct a new instance of `HDate` from a Gematriya-formatted string
823
+
824
+ **Kind**: static method of [<code>HDate</code>](#HDate)
825
+
826
+ | Param | Type | Default |
827
+ | --- | --- | --- |
828
+ | str | <code>string</code> | |
829
+ | currentThousands | <code>number</code> | <code>5000</code> |
830
+
831
+ **Example**
832
+ ```js
833
+ HDate.fromGematriyaString('כ״ז בְּתַמּוּז תשפ״ג') // 27 Tamuz 5783
834
+ HDate.fromGematriyaString('כ׳ סיון תש״ד') // 20 Sivan 5704
835
+ HDate.fromGematriyaString('ה׳ אִיָיר תש״ח') // 5 Iyyar 5708
836
+ ```
785
837
  <a name="Event"></a>
786
838
 
787
839
  ## Event
@@ -2692,6 +2744,21 @@ gematriya(60) // 'ס׳'
2692
2744
  gematriya(3761) // 'ג׳תשס״א'
2693
2745
  gematriya(1123) // 'א׳קכ״ג'
2694
2746
  ```
2747
+ <a name="gematriyaStrToNum"></a>
2748
+
2749
+ ## gematriyaStrToNum(str) ⇒ <code>number</code>
2750
+ Converts a string of Hebrew letters to a numerical value.
2751
+
2752
+ Only considers the value of Hebrew letters `א` through `ת`.
2753
+ Ignores final Hebrew letters such as `ך` (kaf sofit) or `ם` (mem sofit)
2754
+ and vowels (nekudot).
2755
+
2756
+ **Kind**: global function
2757
+
2758
+ | Param | Type |
2759
+ | --- | --- |
2760
+ | str | <code>string</code> |
2761
+
2695
2762
  <a name="ZmanimTimesResult"></a>
2696
2763
 
2697
2764
  ## ZmanimTimesResult : <code>Object</code>