xml-twig 1.3.3 → 1.3.5

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
@@ -33,7 +33,7 @@ npm install node-expat
33
33
  npm install saxophone
34
34
 
35
35
  ```
36
- In my tests I parsed a 900 MB big XML file, the `node-expat` is faster than `sax` (node-expat: around 2:50 Minutes, sax: around 4:10 Minutes). However, you may run into problems when you try to install the `node-expat` parser. That's the reason why `node-expat` parser is not installed automatically. `saxophone` is even a little faster (around 2:10 Minutes) than `node-expat`, however `saxophone` lacks some functions and is not fully compliant to XML standards.
36
+ In my tests I parsed a 900 MB big XML file, the `node-expat` is faster than `sax` (node-expat: around 2:30 Minutes, sax: around 3:40 Minutes). However, you may run into problems when you try to install the `node-expat` parser. That's the reason why `node-expat` parser is not installed automatically. `saxophone` is even a little faster (around 2:10 Minutes) than `node-expat`, however `saxophone` lacks some functions and is not fully compliant to XML standards.
37
37
 
38
38
  ## How to use it
39
39
 
package/doc/twig.md CHANGED
@@ -244,13 +244,13 @@ Purges the current, typically used after element has been processed.<br>The root
244
244
  <a name="Twig+purgeUpTo"></a>
245
245
 
246
246
  ### twig.purgeUpTo
247
- Purges up to the elt element. This allows you to keep part of the tree in memory when you purge.
247
+ Purges up to the elt element. This allows you to keep part of the tree in memory when you purge.<br>
248
248
 
249
249
  **Kind**: instance property of [<code>Twig</code>](#Twig)
250
250
 
251
251
  | Param | Type | Description |
252
252
  | --- | --- | --- |
253
- | [elt] | [<code>Twig</code>](#Twig) | Up to this element the tree will be purged. The `elt` object itself is not purged.<br> If `undefined` then the current element is purged (i.e. `purge()`) |
253
+ | [elt] | [<code>Twig</code>](#Twig) | Up to this element the tree will be purged. If `undefined` then the current element is purged (i.e. `purge()`) |
254
254
 
255
255
  <a name="Twig+escapeEntity"></a>
256
256
 
@@ -861,13 +861,13 @@ Purges the current, typically used after element has been processed.<br>The root
861
861
  <a name="Twig+purgeUpTo"></a>
862
862
 
863
863
  ### twig.purgeUpTo
864
- Purges up to the elt element. This allows you to keep part of the tree in memory when you purge.
864
+ Purges up to the elt element. This allows you to keep part of the tree in memory when you purge.<br>
865
865
 
866
866
  **Kind**: instance property of [<code>Twig</code>](#Twig)
867
867
 
868
868
  | Param | Type | Description |
869
869
  | --- | --- | --- |
870
- | [elt] | [<code>Twig</code>](#Twig) | Up to this element the tree will be purged. The `elt` object itself is not purged.<br> If `undefined` then the current element is purged (i.e. `purge()`) |
870
+ | [elt] | [<code>Twig</code>](#Twig) | Up to this element the tree will be purged. If `undefined` then the current element is purged (i.e. `purge()`) |
871
871
 
872
872
  <a name="Twig+escapeEntity"></a>
873
873
 
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  },
6
6
  "name": "xml-twig",
7
7
  "description": "Node module for processing huge XML documents in tree mode",
8
- "version": "1.3.3",
8
+ "version": "1.3.5",
9
9
  "main": "twig.js",
10
10
  "directories": {
11
11
  "doc": "doc"
package/twig.js CHANGED
@@ -29,7 +29,9 @@ let current;
29
29
 
30
30
  /**
31
31
  * @external libxmljs
32
- * @todo Not yet implemented, maybe later. Not sure if `WritableStream` is supported
32
+ * Though module looks promising, it is not implemented, because it does not support Streams.
33
+ * According to {@link https://github.com/libxmljs/libxmljs/issues/390|Stream Support} it was requested in 2016, i.e. 8 years ago.
34
+ * Apart from that, documentation is very sparse.
33
35
  * @see {@link https://www.npmjs.com/package/libxmljs|libxmljs}
34
36
  */
35
37
 
@@ -610,19 +612,17 @@ class Twig {
610
612
  };
611
613
 
612
614
  /**
613
- * Purges up to the elt element. This allows you to keep part of the tree in memory when you purge.
614
- * @param {Twig} [elt] - Up to this element the tree will be purged. The `elt` object itself is not purged.<br>
615
+ * Purges up to the elt element. This allows you to keep part of the tree in memory when you purge.<br>
616
+ * The `elt` object is not purged. If you like to purge including `elt`, use `.purgeUpTo(elt.previous())`
617
+ * @param {Twig} [elt] - Up to this element the tree will be purged.
615
618
  * If `undefined` then the current element is purged (i.e. `purge()`)
616
619
  */
617
620
  purgeUpTo = function (elt) {
618
621
  if (elt === undefined) {
619
622
  this.purge();
620
623
  } else {
621
- const purgeThis = this.descendantOrSelf();
622
- let toPurge = purgeThis[purgeThis.length - 1];
623
- const descendantOrSelf = elt.descendantOrSelf();
624
- const stopAt = descendantOrSelf[descendantOrSelf.length - 1];
625
- while (toPurge !== null && !Object.is(toPurge, stopAt)) {
624
+ let toPurge = this;
625
+ while (toPurge !== null && !Object.is(toPurge, elt)) {
626
626
  const prev = toPurge.previous();
627
627
  toPurge.purge();
628
628
  toPurge = prev;