fast-xml-parser 3.17.3 → 3.17.4

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
@@ -1,8 +1,26 @@
1
+
2
+
1
3
  # [fast-xml-parser](https://www.npmjs.com/package/fast-xml-parser)
4
+ [![Backers on Open Collective](https://opencollective.com/fast-xml-parser/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/fast-xml-parser/sponsors/badge.svg)](#sponsors) [![Known Vulnerabilities](https://snyk.io/test/github/naturalintelligence/fast-xml-parser/badge.svg)](https://snyk.io/test/github/naturalintelligence/fast-xml-parser)
5
+ [![NPM quality][quality-image]][quality-url]
6
+ [![Travis ci Build Status](https://travis-ci.org/NaturalIntelligence/fast-xml-parser.svg?branch=master)](https://travis-ci.org/NaturalIntelligence/fast-xml-parser)
7
+ [![Coverage Status](https://coveralls.io/repos/github/NaturalIntelligence/fast-xml-parser/badge.svg?branch=master)](https://coveralls.io/github/NaturalIntelligence/fast-xml-parser?branch=master)
8
+ [<img src="https://img.shields.io/badge/Try-me-blue.svg?colorA=FFA500&colorB=0000FF" alt="Try me"/>](https://naturalintelligence.github.io/fast-xml-parser/)
9
+ [![NPM total downloads](https://img.shields.io/npm/dt/fast-xml-parser.svg)](https://npm.im/fast-xml-parser)
10
+
11
+ [quality-image]: http://npm.packagequality.com/shield/fast-xml-parser.svg?style=flat-square
12
+ [quality-url]: http://packagequality.com/#?package=fast-xml-parser
13
+
14
+
2
15
  Validate XML, Parse XML to JS/JSON and vice versa, or parse XML to Nimn rapidly without C/C++ based libraries and no callback
3
16
 
4
- > This project welcomes **contributors**. If you have a feature you'd like to see implemented or a bug you'd liked fixed, the best and fastest way to make that happen is to implement it and submit a PR. Basic knowledge of JS is sufficient. Feel free to ask for any guidance.
17
+ ![Donate $5](static/img/donation_quote.png)
5
18
 
19
+ <a href="https://opencollective.com/fast-xml-parser/donate" target="_blank">
20
+ <img src="https://opencollective.com/fast-xml-parser/donate/button@2x.png?color=blue" width=200 />
21
+ </a>
22
+ <a href="https://www.patreon.com/bePatron?u=9531404" data-patreon-widget-type="become-patron-button"><img src="https://c5.patreon.com/external/logo/become_a_patron_button.png" alt="Become a Patron!" width="200" /></a>
23
+ <a href="https://paypal.me/naturalintelligence"> <img src="static/img/support_paypal.svg" alt="Stubmatic donate button" width="200"/></a>
6
24
 
7
25
  ## Users
8
26
  List of some applications/projects using Fast XML Parser. (Raise an issue to submit yours)
@@ -64,25 +82,8 @@ List of some applications/projects using Fast XML Parser. (Raise an issue to sub
64
82
 
65
83
 
66
84
 
67
- ### Join this project as collaborator / maintainer.
68
85
 
69
86
 
70
- [![Backers on Open Collective](https://opencollective.com/fast-xml-parser/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/fast-xml-parser/sponsors/badge.svg)](#sponsors) [![Known Vulnerabilities](https://snyk.io/test/github/naturalintelligence/fast-xml-parser/badge.svg)](https://snyk.io/test/github/naturalintelligence/fast-xml-parser)
71
- [![NPM quality][quality-image]][quality-url]
72
- [![Travis ci Build Status](https://travis-ci.org/NaturalIntelligence/fast-xml-parser.svg?branch=master)](https://travis-ci.org/NaturalIntelligence/fast-xml-parser)
73
- [![Coverage Status](https://coveralls.io/repos/github/NaturalIntelligence/fast-xml-parser/badge.svg?branch=master)](https://coveralls.io/github/NaturalIntelligence/fast-xml-parser?branch=master)
74
- [<img src="https://img.shields.io/badge/Try-me-blue.svg?colorA=FFA500&colorB=0000FF" alt="Try me"/>](https://naturalintelligence.github.io/fast-xml-parser/)
75
- [![NPM total downloads](https://img.shields.io/npm/dt/fast-xml-parser.svg)](https://npm.im/fast-xml-parser)
76
-
77
- [quality-image]: http://npm.packagequality.com/shield/fast-xml-parser.svg?style=flat-square
78
- [quality-url]: http://packagequality.com/#?package=fast-xml-parser
79
-
80
- <a href="https://opencollective.com/fast-xml-parser/donate" target="_blank">
81
- <img src="https://opencollective.com/fast-xml-parser/donate/button@2x.png?color=blue" width=200 />
82
- </a>
83
- <a href="https://www.patreon.com/bePatron?u=9531404" data-patreon-widget-type="become-patron-button"><img src="https://c5.patreon.com/external/logo/become_a_patron_button.png" alt="Become a Patron!" width="200" /></a>
84
- <a href="https://www.paypal.me/amitkumarguptagwl"> <img src="static/img/support_paypal.svg" alt="Stubmatic donate button" width="200"/></a>
85
-
86
87
  ### Main Features
87
88
 
88
89
  <img align="right" src="static/img/fxp_logo.png" width="180px" alt="FXP logo"/>
@@ -313,6 +314,7 @@ With the correct options, you can get the almost original XML without losing any
313
314
  - [शब्दावली (shabdawali)](https://github.com/amitguptagwl/shabdawali) : Amazing human like typing effects beyond your imagination.
314
315
 
315
316
 
317
+
316
318
  ## Contributors
317
319
 
318
320
  This project exists thanks to [all](graphs/contributors) the people who contribute. [[Contribute](CONTRIBUTING.md)].
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fast-xml-parser",
3
- "version": "3.17.3",
3
+ "version": "3.17.4",
4
4
  "description": "Validate XML or Parse XML to JS/JSON very fast without C/C++ based libraries",
5
5
  "main": "./src/parser.js",
6
6
  "scripts": {
@@ -70,10 +70,10 @@
70
70
  ],
71
71
  "license": "MIT",
72
72
  "devDependencies": {
73
- "@babel/core": "^7.9.6",
74
- "@babel/plugin-transform-runtime": "^7.9.6",
75
- "@babel/preset-env": "^7.9.6",
76
- "@babel/register": "^7.9.0",
73
+ "@babel/core": "^7.10.2",
74
+ "@babel/plugin-transform-runtime": "^7.10.1",
75
+ "@babel/preset-env": "^7.10.2",
76
+ "@babel/register": "^7.10.1",
77
77
  "babel-loader": "^8.1.0",
78
78
  "eslint": "^5.16.0",
79
79
  "he": "^1.2.0",
@@ -86,5 +86,9 @@
86
86
  "webpack": "^4.43.0",
87
87
  "webpack-cli": "^3.3.11"
88
88
  },
89
- "typings": "src/parser.d.ts"
89
+ "typings": "src/parser.d.ts",
90
+ "funding": {
91
+ "type": "paypal",
92
+ "url": "https://paypal.me/naturalintelligence"
93
+ }
90
94
  }
package/src/parser.js CHANGED
@@ -44,12 +44,12 @@ function print(xmlNode, indentation){
44
44
  if(xmlNode.child){
45
45
  console.log(indentation + "\"child\": {")
46
46
  const indentation2 = indentation + indentation;
47
- Object.keys(xmlNode.child).forEach( key =>{
47
+ Object.keys(xmlNode.child).forEach( function(key) {
48
48
  const node = xmlNode.child[key];
49
49
 
50
50
  if(Array.isArray(node)){
51
51
  console.log(indentation + "\""+key+"\" :[")
52
- node.forEach( (item,index) => {
52
+ node.forEach( function(item,index) {
53
53
  //console.log(indentation + " \""+index+"\" : [")
54
54
  print(item, indentation2);
55
55
  })
@@ -272,7 +272,7 @@ const getTraversalObj = function(xmlData, options) {
272
272
  }
273
273
  }
274
274
 
275
- if(tagExp.lastIndexOf("/") === tagExp.length - 1){//selfClosing tag
275
+ if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){//selfClosing tag
276
276
 
277
277
  if(tagName[tagName.length - 1] === "/"){ //remove trailing '/'
278
278
  tagName = tagName.substr(0, tagName.length - 1);