hebrew-transliteration 2.0.3 → 2.0.6

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/dist/index.d.ts CHANGED
@@ -649,7 +649,7 @@ declare module 'hebrew-transliteration/transliterate' {
649
649
  * ```
650
650
  *
651
651
  */
652
- export const transliterate: (text: string | Text, schema?: Schema | Partial<Schema> | undefined) => string;
652
+ export const transliterate: (text: string | Text, schema?: Partial<Schema> | Schema) => string;
653
653
 
654
654
  }
655
655
  declare module 'hebrew-transliteration' {
package/dist/index.esm.js CHANGED
@@ -250,6 +250,8 @@ var wordRules = (word, schema) => {
250
250
  return schema.DIVINE_NAME;
251
251
  if (word.hasDivineName)
252
252
  return `${sylRules(word.syllables[0], schema)}-${schema.DIVINE_NAME}`;
253
+ if (word.isNotHebrew)
254
+ return word.text;
253
255
  if ((_a = schema.ADDITIONAL_FEATURES) == null ? void 0 : _a.length) {
254
256
  const wordSeqs = schema.ADDITIONAL_FEATURES.filter((s) => s.FEATURE === "word");
255
257
  for (const seq of wordSeqs) {
@@ -272,6 +274,7 @@ var Schema = class {
272
274
  };
273
275
  var SBL = class extends Schema {
274
276
  constructor(schema) {
277
+ var _a, _b, _c, _d, _e, _f;
275
278
  super({
276
279
  VOCAL_SHEVA: schema.VOCAL_SHEVA || "\u01DD",
277
280
  HATAF_SEGOL: schema.HATAF_SEGOL || "\u0115",
@@ -344,7 +347,6 @@ var SBL = class extends Schema {
344
347
  wawShureq: (_e = schema.wawShureq) != null ? _e : true,
345
348
  article: (_f = schema.article) != null ? _f : true
346
349
  });
347
- var _a, _b, _c, _d, _e, _f;
348
350
  }
349
351
  };
350
352
 
@@ -368,8 +370,10 @@ var getSylOpts = (schema) => {
368
370
  var transliterate = (text, schema) => {
369
371
  const transSchema = schema instanceof Schema ? schema : new SBL(schema != null ? schema : {});
370
372
  const isText = text instanceof Text2;
371
- if (!isText && !vowels.test(text))
372
- return mapChars(text, transSchema);
373
+ if (!isText && !vowels.test(text)) {
374
+ const sin = new RegExp(transSchema.SHIN + "\u05C2", "gu");
375
+ return mapChars(text, transSchema).replace(sin, transSchema.SIN).replace(/\u{05C1}/gu, "");
376
+ }
373
377
  const sylOptions = getSylOpts(transSchema != null ? transSchema : {});
374
378
  const newText = isText ? text : new Text2(text, sylOptions);
375
379
  return newText.words.map((word) => {
package/dist/index.js CHANGED
@@ -1,25 +1,21 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
6
6
  var __export = (target, all) => {
7
7
  for (var name in all)
8
8
  __defProp(target, name, { get: all[name], enumerable: true });
9
9
  };
10
- var __reExport = (target, module2, copyDefault, desc) => {
11
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
12
- for (let key of __getOwnPropNames(module2))
13
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
14
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
15
  }
16
- return target;
16
+ return to;
17
17
  };
18
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
19
- return (module2, temp) => {
20
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
21
- };
22
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
19
 
24
20
  // src/index.ts
25
21
  var src_exports = {};
@@ -30,6 +26,7 @@ __export(src_exports, {
30
26
  sequence: () => sequence,
31
27
  transliterate: () => transliterate
32
28
  });
29
+ module.exports = __toCommonJS(src_exports);
33
30
  var import_havarotjs3 = require("havarotjs");
34
31
 
35
32
  // src/sequence.ts
@@ -281,6 +278,8 @@ var wordRules = (word, schema) => {
281
278
  return schema.DIVINE_NAME;
282
279
  if (word.hasDivineName)
283
280
  return `${sylRules(word.syllables[0], schema)}-${schema.DIVINE_NAME}`;
281
+ if (word.isNotHebrew)
282
+ return word.text;
284
283
  if ((_a = schema.ADDITIONAL_FEATURES) == null ? void 0 : _a.length) {
285
284
  const wordSeqs = schema.ADDITIONAL_FEATURES.filter((s) => s.FEATURE === "word");
286
285
  for (const seq of wordSeqs) {
@@ -303,6 +302,7 @@ var Schema = class {
303
302
  };
304
303
  var SBL = class extends Schema {
305
304
  constructor(schema) {
305
+ var _a, _b, _c, _d, _e, _f;
306
306
  super({
307
307
  VOCAL_SHEVA: schema.VOCAL_SHEVA || "\u01DD",
308
308
  HATAF_SEGOL: schema.HATAF_SEGOL || "\u0115",
@@ -375,7 +375,6 @@ var SBL = class extends Schema {
375
375
  wawShureq: (_e = schema.wawShureq) != null ? _e : true,
376
376
  article: (_f = schema.article) != null ? _f : true
377
377
  });
378
- var _a, _b, _c, _d, _e, _f;
379
378
  }
380
379
  };
381
380
 
@@ -399,8 +398,10 @@ var getSylOpts = (schema) => {
399
398
  var transliterate = (text, schema) => {
400
399
  const transSchema = schema instanceof Schema ? schema : new SBL(schema != null ? schema : {});
401
400
  const isText = text instanceof import_havarotjs2.Text;
402
- if (!isText && !vowels.test(text))
403
- return mapChars(text, transSchema);
401
+ if (!isText && !vowels.test(text)) {
402
+ const sin = new RegExp(transSchema.SHIN + "\u05C2", "gu");
403
+ return mapChars(text, transSchema).replace(sin, transSchema.SIN).replace(/\u{05C1}/gu, "");
404
+ }
404
405
  const sylOptions = getSylOpts(transSchema != null ? transSchema : {});
405
406
  const newText = isText ? text : new import_havarotjs2.Text(text, sylOptions);
406
407
  return newText.words.map((word) => {
@@ -426,7 +427,6 @@ var remove = (text, { removeVowels = false, removeShinDot = false, removeSinDot
426
427
  const remShin = removeShinDot ? removeItem(remVowels, shinDot) : remVowels;
427
428
  return removeSinDot ? removeItem(remShin, sinDot) : remShin;
428
429
  };
429
- module.exports = __toCommonJS(src_exports);
430
430
  // Annotate the CommonJS export names for ESM import in node:
431
431
  0 && (module.exports = {
432
432
  Schema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hebrew-transliteration",
3
- "version": "2.0.3",
3
+ "version": "2.0.6",
4
4
  "description": "a package for transliterating Hebrew",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -37,22 +37,22 @@
37
37
  "author": "Charles Loder",
38
38
  "license": "MIT",
39
39
  "devDependencies": {
40
- "@types/jest": "^27.4.1",
41
- "@typescript-eslint/eslint-plugin": "^5.13.0",
42
- "esbuild": "^0.14.25",
43
- "eslint": "^8.10.0",
40
+ "@types/jest": "^28.1.4",
41
+ "@typescript-eslint/eslint-plugin": "^5.30.4",
42
+ "esbuild": "^0.14.48",
43
+ "eslint": "^8.19.0",
44
44
  "eslint-config-prettier": "^8.5.0",
45
- "eslint-plugin-jest": "^26.1.1",
46
- "eslint-plugin-jsdoc": "^37.9.6",
45
+ "eslint-plugin-jest": "^26.5.3",
46
+ "eslint-plugin-jsdoc": "^39.3.3",
47
47
  "eslint-plugin-prefer-arrow": "^1.2.3",
48
- "jest": "^27.5.1",
49
- "npm-check-updates": "^12.5.2",
50
- "npm-dts": "^1.3.11",
51
- "prettier": "^2.5.1",
52
- "ts-jest": "^27.1.3",
53
- "typescript": "^4.6.2"
48
+ "jest": "^28.1.2",
49
+ "npm-check-updates": "^15.0.2",
50
+ "npm-dts": "^1.3.12",
51
+ "prettier": "^2.7.1",
52
+ "ts-jest": "^28.0.5",
53
+ "typescript": "^4.7.4"
54
54
  },
55
55
  "dependencies": {
56
- "havarotjs": "^0.7.3"
56
+ "havarotjs": "^0.8.0"
57
57
  }
58
58
  }