html-react-parser 5.1.0 → 5.1.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
@@ -207,7 +207,7 @@ parse('<br>', {
207
207
  ```
208
208
 
209
209
  > [!NOTE]
210
- > The index will restart at 0 when traversing the node's children so don't rely on index being a unique key.
210
+ > The index will restart at 0 when traversing the node's children so don't rely on index being a unique key. See [#1259](https://github.com/remarkablemark/html-react-parser/issues/1259#issuecomment-1889574133).
211
211
 
212
212
  #### replace with TypeScript
213
213
 
@@ -2657,10 +2657,11 @@
2657
2657
  * @returns - String or JSX element(s).
2658
2658
  */
2659
2659
  function domToReact(nodes, options) {
2660
+ if (options === void 0) { options = {}; }
2660
2661
  var reactElements = [];
2661
- var hasReplace = typeof (options === null || options === void 0 ? void 0 : options.replace) === 'function';
2662
- var transform = (options === null || options === void 0 ? void 0 : options.transform) || utilities_1.returnFirstArg;
2663
- var _a = (options === null || options === void 0 ? void 0 : options.library) || React, cloneElement = _a.cloneElement, createElement = _a.createElement, isValidElement = _a.isValidElement;
2662
+ var hasReplace = typeof options.replace === 'function';
2663
+ var transform = options.transform || utilities_1.returnFirstArg;
2664
+ var _a = options.library || React, cloneElement = _a.cloneElement, createElement = _a.createElement, isValidElement = _a.isValidElement;
2664
2665
  var nodesLength = nodes.length;
2665
2666
  for (var index = 0; index < nodesLength; index++) {
2666
2667
  var node = nodes[index];
@@ -2690,7 +2691,7 @@
2690
2691
  }
2691
2692
  // Trim is enabled and we have a whitespace node
2692
2693
  // so skip it
2693
- if ((options === null || options === void 0 ? void 0 : options.trim) && isWhitespace) {
2694
+ if (options.trim && isWhitespace) {
2694
2695
  continue;
2695
2696
  }
2696
2697
  // We have a text node that's not whitespace and it can be nested