fast-xml-parser
Advanced tools
Comparing version 3.21.0 to 3.21.1
{ | ||
"name": "fast-xml-parser", | ||
"version": "3.21.0", | ||
"version": "3.21.1", | ||
"description": "Validate XML or Parse XML to JS/JSON very fast without C/C++ based libraries", | ||
"main": "./src/parser.js", | ||
"scripts": { | ||
"test": "npx nyc jasmine spec/*spec.js", | ||
"test": "nyc --reporter=lcov --reporter=text jasmine spec/*spec.js", | ||
"unit": "jasmine", | ||
"coverage": "npx nyc report --reporter html --reporter text -t .nyc_output --report-dir .nyc_output/summary", | ||
"coverage": "nyc report --reporter html --reporter text -t .nyc_output --report-dir .nyc_output/summary", | ||
"perf": "node ./benchmark/perfTest3.js", | ||
@@ -80,2 +80,3 @@ "lint": "eslint src/*.js spec/*.js", | ||
"nimnjs": "^1.3.2", | ||
"nyc": "^15.1.0", | ||
"prettier": "^1.19.1", | ||
@@ -92,5 +93,4 @@ "publish-please": "^5.5.2", | ||
"dependencies": { | ||
"nyc": "^15.1.0", | ||
"strnum": "^1.0.4" | ||
} | ||
} |
@@ -58,2 +58,4 @@ 'use strict'; | ||
this.processTextOrObjNode = processTextOrObjNode | ||
if (this.options.format) { | ||
@@ -95,6 +97,3 @@ this.indentate = indentate; | ||
let val = ''; | ||
const keys = Object.keys(jObj); | ||
const len = keys.length; | ||
for (let i = 0; i < len; i++) { | ||
const key = keys[i]; | ||
for (let key in jObj) { | ||
if (typeof jObj[key] === 'undefined') { | ||
@@ -148,4 +147,3 @@ // supress undefined node | ||
} else if (typeof item === 'object') { | ||
const result = this.j2x(item, level + 1); | ||
val += this.buildObjNode(result.val, key, result.attrStr, level); | ||
val += this.processTextOrObjNode(item, key, level) | ||
} else { | ||
@@ -165,4 +163,3 @@ val += this.buildTextNode(item, key, '', level); | ||
} else { | ||
const result = this.j2x(jObj[key], level + 1); | ||
val += this.buildObjNode(result.val, key, result.attrStr, level); | ||
val += this.processTextOrObjNode(jObj[key], key, level) | ||
} | ||
@@ -174,2 +171,11 @@ } | ||
function processTextOrObjNode (object, key, level) { | ||
const result = this.j2x(object, level + 1); | ||
if (object[this.options.textNodeName] !== undefined && Object.keys(object).length === 1) { | ||
return this.buildTextNode(result.val, key, result.attrStr, level); | ||
} else { | ||
return this.buildObjNode(result.val, key, result.attrStr, level); | ||
} | ||
} | ||
function replaceCDATAstr(str, cdata) { | ||
@@ -197,3 +203,3 @@ str = this.options.tagValueProcessor('' + str); | ||
function buildObjectNode(val, key, attrStr, level) { | ||
if (attrStr && !val.includes('<')) { | ||
if (attrStr && val.indexOf('<') === -1) { | ||
return ( | ||
@@ -200,0 +206,0 @@ this.indentate(level) + |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79718
1
1579
14
- Removednyc@^15.1.0
- Removed@ampproject/remapping@2.3.0(transitive)
- Removed@babel/code-frame@7.25.7(transitive)
- Removed@babel/compat-data@7.25.7(transitive)
- Removed@babel/core@7.25.7(transitive)
- Removed@babel/generator@7.25.7(transitive)
- Removed@babel/helper-compilation-targets@7.25.7(transitive)
- Removed@babel/helper-module-imports@7.25.7(transitive)
- Removed@babel/helper-module-transforms@7.25.7(transitive)
- Removed@babel/helper-simple-access@7.25.7(transitive)
- Removed@babel/helper-string-parser@7.25.7(transitive)
- Removed@babel/helper-validator-identifier@7.25.7(transitive)
- Removed@babel/helper-validator-option@7.25.7(transitive)
- Removed@babel/helpers@7.25.7(transitive)
- Removed@babel/highlight@7.25.7(transitive)
- Removed@babel/parser@7.25.7(transitive)
- Removed@babel/template@7.25.7(transitive)
- Removed@babel/traverse@7.25.7(transitive)
- Removed@babel/types@7.25.7(transitive)
- Removed@istanbuljs/load-nyc-config@1.1.0(transitive)
- Removed@istanbuljs/schema@0.1.3(transitive)
- Removed@jridgewell/gen-mapping@0.3.5(transitive)
- Removed@jridgewell/resolve-uri@3.1.2(transitive)
- Removed@jridgewell/set-array@1.2.1(transitive)
- Removed@jridgewell/sourcemap-codec@1.5.0(transitive)
- Removed@jridgewell/trace-mapping@0.3.25(transitive)
- Removedaggregate-error@3.1.0(transitive)
- Removedansi-regex@5.0.1(transitive)
- Removedansi-styles@3.2.14.3.0(transitive)
- Removedappend-transform@2.0.0(transitive)
- Removedarchy@1.0.0(transitive)
- Removedargparse@1.0.10(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedbrowserslist@4.24.0(transitive)
- Removedcaching-transform@4.0.0(transitive)
- Removedcamelcase@5.3.1(transitive)
- Removedcaniuse-lite@1.0.30001667(transitive)
- Removedchalk@2.4.2(transitive)
- Removedclean-stack@2.2.0(transitive)
- Removedcliui@6.0.0(transitive)
- Removedcolor-convert@1.9.32.0.1(transitive)
- Removedcolor-name@1.1.31.1.4(transitive)
- Removedcommondir@1.0.1(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedconvert-source-map@1.9.02.0.0(transitive)
- Removedcross-spawn@7.0.3(transitive)
- Removeddebug@4.3.7(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removeddefault-require-extensions@3.0.1(transitive)
- Removedelectron-to-chromium@1.5.32(transitive)
- Removedemoji-regex@8.0.0(transitive)
- Removedes6-error@4.1.1(transitive)
- Removedescalade@3.2.0(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedesprima@4.0.1(transitive)
- Removedfind-cache-dir@3.3.2(transitive)
- Removedfind-up@4.1.0(transitive)
- Removedforeground-child@2.0.0(transitive)
- Removedfromentries@1.3.2(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedgensync@1.0.0-beta.2(transitive)
- Removedget-caller-file@2.0.5(transitive)
- Removedget-package-type@0.1.0(transitive)
- Removedglob@7.2.3(transitive)
- Removedglobals@11.12.0(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedhas-flag@3.0.04.0.0(transitive)
- Removedhasha@5.2.2(transitive)
- Removedhtml-escaper@2.0.2(transitive)
- Removedimurmurhash@0.1.4(transitive)
- Removedindent-string@4.0.0(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedis-fullwidth-code-point@3.0.0(transitive)
- Removedis-stream@2.0.1(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedis-windows@1.0.2(transitive)
- Removedisexe@2.0.0(transitive)
- Removedistanbul-lib-coverage@3.2.2(transitive)
- Removedistanbul-lib-hook@3.0.0(transitive)
- Removedistanbul-lib-instrument@4.0.3(transitive)
- Removedistanbul-lib-processinfo@2.0.3(transitive)
- Removedistanbul-lib-report@3.0.1(transitive)
- Removedistanbul-lib-source-maps@4.0.1(transitive)
- Removedistanbul-reports@3.1.7(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedjs-yaml@3.14.1(transitive)
- Removedjsesc@3.0.2(transitive)
- Removedjson5@2.2.3(transitive)
- Removedlocate-path@5.0.0(transitive)
- Removedlodash.flattendeep@4.4.0(transitive)
- Removedlru-cache@5.1.1(transitive)
- Removedmake-dir@3.1.04.0.0(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedms@2.1.3(transitive)
- Removednode-preload@0.2.1(transitive)
- Removednode-releases@2.0.18(transitive)
- Removednyc@15.1.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedp-limit@2.3.0(transitive)
- Removedp-locate@4.1.0(transitive)
- Removedp-map@3.0.0(transitive)
- Removedp-try@2.2.0(transitive)
- Removedpackage-hash@4.0.0(transitive)
- Removedpath-exists@4.0.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpath-key@3.1.1(transitive)
- Removedpicocolors@1.1.0(transitive)
- Removedpkg-dir@4.2.0(transitive)
- Removedprocess-on-spawn@1.0.0(transitive)
- Removedrelease-zalgo@1.0.0(transitive)
- Removedrequire-directory@2.1.1(transitive)
- Removedrequire-main-filename@2.0.0(transitive)
- Removedresolve-from@5.0.0(transitive)
- Removedrimraf@3.0.2(transitive)
- Removedsemver@6.3.17.6.3(transitive)
- Removedset-blocking@2.0.0(transitive)
- Removedshebang-command@2.0.0(transitive)
- Removedshebang-regex@3.0.0(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedspawn-wrap@2.0.0(transitive)
- Removedsprintf-js@1.0.3(transitive)
- Removedstring-width@4.2.3(transitive)
- Removedstrip-ansi@6.0.1(transitive)
- Removedstrip-bom@4.0.0(transitive)
- Removedsupports-color@5.5.07.2.0(transitive)
- Removedtest-exclude@6.0.0(transitive)
- Removedto-fast-properties@2.0.0(transitive)
- Removedtype-fest@0.8.1(transitive)
- Removedtypedarray-to-buffer@3.1.5(transitive)
- Removedupdate-browserslist-db@1.1.1(transitive)
- Removeduuid@8.3.2(transitive)
- Removedwhich@2.0.2(transitive)
- Removedwhich-module@2.0.1(transitive)
- Removedwrap-ansi@6.2.0(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedwrite-file-atomic@3.0.3(transitive)
- Removedy18n@4.0.3(transitive)
- Removedyallist@3.1.1(transitive)
- Removedyargs@15.4.1(transitive)
- Removedyargs-parser@18.1.3(transitive)