usfm-grammar-web 3.2.0-beta.1 → 3.2.0-beta.2

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
@@ -23,10 +23,10 @@ function App() {
23
23
 
24
24
  useEffect(() => {
25
25
  const initParser = async () => {
26
- await USFMParser.init("https://cdn.jsdelivr.net/npm/usfm-grammar-web@3.2.0-beta.1/tree-sitter-usfm.wasm",
27
- "https://cdn.jsdelivr.net/npm/usfm-grammar-web@3.2.0-beta.1/tree-sitter.wasm");
28
- await Validator.init("https://cdn.jsdelivr.net/npm/usfm-grammar-web@3.2.0-beta.1/tree-sitter-usfm.wasm",
29
- "https://cdn.jsdelivr.net/npm/usfm-grammar-web@3.2.0-beta.1/tree-sitter.wasm");
26
+ await USFMParser.init("https://cdn.jsdelivr.net/npm/usfm-grammar-web@3.2.0-beta.2/tree-sitter-usfm.wasm",
27
+ "https://cdn.jsdelivr.net/npm/usfm-grammar-web@3.2.0-beta.2/tree-sitter.wasm");
28
+ await Validator.init("https://cdn.jsdelivr.net/npm/usfm-grammar-web@3.2.0-beta.2/tree-sitter-usfm.wasm",
29
+ "https://cdn.jsdelivr.net/npm/usfm-grammar-web@3.2.0-beta.2/tree-sitter.wasm");
30
30
 
31
31
  };
32
32
  initParser();
@@ -60,13 +60,13 @@ It can be used directly in the HTML script tag too. Please ensure its dependenci
60
60
 
61
61
  ```html
62
62
  <script type="module">
63
- import { USFMParser, Filter, Validator } from 'https://cdn.jsdelivr.net/npm/usfm-grammar-web@3.2.0-beta.1/dist/bundle.mjs';
63
+ import { USFMParser, Filter, Validator } from 'https://cdn.jsdelivr.net/npm/usfm-grammar-web@3.2.0-beta.2/dist/bundle.mjs';
64
64
  console.log('Hello world');
65
65
  (async () => {
66
- await USFMParser.init("https://cdn.jsdelivr.net/npm/usfm-grammar-web@3.2.0-beta.1/tree-sitter-usfm.wasm",
67
- "https://cdn.jsdelivr.net/npm/usfm-grammar-web@3.2.0-beta.1/tree-sitter.wasm");
68
- await Validator.init("https://cdn.jsdelivr.net/npm/usfm-grammar-web@3.2.0-beta.1/tree-sitter-usfm.wasm",
69
- "https://cdn.jsdelivr.net/npm/usfm-grammar-web@3.2.0-beta.1/tree-sitter.wasm");
66
+ await USFMParser.init("https://cdn.jsdelivr.net/npm/usfm-grammar-web@3.2.0-beta.2/tree-sitter-usfm.wasm",
67
+ "https://cdn.jsdelivr.net/npm/usfm-grammar-web@3.2.0-beta.2/tree-sitter.wasm");
68
+ await Validator.init("https://cdn.jsdelivr.net/npm/usfm-grammar-web@3.2.0-beta.2/tree-sitter-usfm.wasm",
69
+ "https://cdn.jsdelivr.net/npm/usfm-grammar-web@3.2.0-beta.2/tree-sitter.wasm");
70
70
  const usfmParser = new USFMParser('\\id GEN\n\\c 1\n\\p\n\\v 1 In the begining..\\v 2 more text')
71
71
  const output = usfmParser.toUSJ()
72
72
  console.log({ output })
package/dist/bundle.mjs CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as $5OpyM$fspromises from "fs/promises";
2
2
  import * as $5OpyM$module from "module";
3
- import $5OpyM$assert from "assert";
4
3
  import {DOMImplementation as $5OpyM$DOMImplementation} from "xmldom";
5
4
  import $5OpyM$ajv from "ajv";
6
5
 
@@ -3468,7 +3467,6 @@ module.exports = new URL("tree-sitter.0080292a.wasm", import.meta.url).toString(
3468
3467
  });
3469
3468
 
3470
3469
 
3471
-
3472
3470
  var $dc2P8 = parcelRequire("dc2P8");
3473
3471
  const $142605215cbb4f88$export$b32929182cc4fefe = [
3474
3472
  'USJ',
@@ -47147,9 +47145,9 @@ Only one of USFM, USJ, USX or BibleNLP is supported in one object.`);
47147
47145
  }
47148
47146
  convertUSXToUSFM() {
47149
47147
  try {
47150
- (0, $5OpyM$assert)(1 <= this.usx.nodeType && this.usx.nodeType <= 12, 'Input must be an instance of xmldom Document or Element');
47148
+ if (!(1 <= this.usx.nodeType && this.usx.nodeType <= 12)) throw new Error('Input must be an instance of xmldom Document or Element');
47151
47149
  if (this.usx.tagName !== 'usx') {
47152
- (0, $5OpyM$assert)(this.usx.getElementsByTagName('usx').length === 1, `Expects a <usx> node.
47150
+ if (!(this.usx.getElementsByTagName('usx').length === 1)) throw new Error(`Expects a <usx> node.
47153
47151
  Refer docs: https://docs.usfm.bible/usfm/3.1/syntax.html#_usx_usfm_xml`);
47154
47152
  this.usx = this.usx.getElementsByTagName('usx')[0];
47155
47153
  }
@@ -47206,10 +47204,9 @@ Refer docs: https://docs.usfm.bible/usfm/3.1/syntax.html#_usx_usfm_xml`);
47206
47204
  }
47207
47205
  convertBibleNLPtoUSFM(bookCode) {
47208
47206
  try {
47209
- (0, $5OpyM$assert)(this.bibleNlp.vref, "Should have 'vref' key");
47210
- (0, $5OpyM$assert)(this.bibleNlp.text, "Should have 'text' key");
47211
- (0, $5OpyM$assert)(Array.isArray(this.bibleNlp.vref), "'vref' should contain an array of references.");
47212
- (0, $5OpyM$assert)(Array.isArray(this.bibleNlp.text), "'text' should contain an array of strings.");
47207
+ if (typeof this.bibleNlp !== 'object' || this.bibleNlp === null) throw new Error('Input must be a non-null object');
47208
+ if (!this.bibleNlp.hasOwnProperty('vref') || !this.bibleNlp.hasOwnProperty('text')) throw new Error("Input object must have 'vref' and 'text' properties");
47209
+ if (!Array.isArray(this.bibleNlp.vref) || !Array.isArray(this.bibleNlp.text) || this.bibleNlp.vref.length === 0 || this.bibleNlp.text.length === 0) throw new Error("'vref' and 'text' properties must be non empty arrays!");
47213
47210
  let vrefs = this.bibleNlp.vref;
47214
47211
  if ([
47215
47212
  31170,