# gematriya

> Convert numbers to gematriya representation, and vice-versa.

Latest version **2.0.0** (published 2019-02-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install gematriya
pnpm add gematriya
yarn add gematriya
bun add gematriya
```

## Health

**Score 18/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2019-02-14 |
| First published | 2014-06-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/gematriya) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 26 |
| Author | Eyal Schachter |
| Maintainers | scimonster |
| Keywords | hebrew, gematriya, numbers |

## Links

- npm: https://www.npmjs.com/package/gematriya
- Repository: https://github.com/Scimonster/js-gematriya
- Issues: https://github.com/Scimonster/js-gematriya/issues
- npm.io page: https://npm.io/package/gematriya

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2019-02-14
- 1.0.1 — 2014-11-20
- 1.0.0 — 2014-06-09

## README

# Gematriya

[Gematriya/Gematria](https://en.wikipedia.org/wiki/Gematria), or perhaps more accurately, [Hebrew numerals](https://en.wikipedia.org/wiki/Hebrew_numerals), is a system of writing numbers as Hebrew letters. This JavaScript module allows for easy conversion between gematriya and JavaScript `Number` types.

This code was originally written for [hebcal/hebcal-js](https://github.com/hebcal/hebcal-js).

## Install

Install gematriya from NPM, bower, or just take the `gematriya.js` script from this repo.

```bash
npm install gematriya
bower install gematriya
```

## API

On the client side, the API is available through the global function `gematriya`. In Node, `require('gematriya')`.

A single function is available. Pass it a `Number` or `String`. Given a number, it will return the string representation. Given a gematriya string, it will return the number it represents.

When passing a string, by default, it just adds up the numbers, regardless of place. By passing `{order: true}` as a second parameter, it will treat it as being ordered, as per the output (see below).

When passing a number, an optional options object is available as a second parameter. Setting a number as a value for the `limit` key will limit the length of the returned string to a number of digits. Setting false as the value for the `punctuate` key will remove double and single quotation marks in the returned string. Setting `geresh` to false will use ASCII single/double quotes instead of Hebrew geresh/gershayim Unicode characters. Like this:

```js
gematriya(5774) // התשע״ד - ordinary
gematriya(5774, {limit: 3}) // תשע״ד - cropped to 774
gematriya(5774, {limit: 7}) // התשע״ד - kept at 5774
gematriya(5774, {punctuate: false}) // 'התשעד' - removed quotation marks
gematriya(5774, {punctuate: true}) // 'התשע״ד' - with quotation marks
gematriya(5774, {geresh: false}) // 'התשע"ד' - with quotation marks
gematriya(5774, {punctuate: false, limit: 3}) // 'תשעד' - options can be combined
gematriya(3) // 'ג׳' - note the geresh is RTL
gematriya(3, {geresh: false}) // - "ג'" - the apostrophe is not
gematriya('התשעד', {order: true}) // 5774 - treats the characters as an ordered number
gematriya('התשעד', {order: false}) // 779 - Adds up all the characters
```

## License

Licensed MIT.

---
_Source: https://npm.io/package/gematriya · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
