xml-formatter
Advanced tools
Comparing version 3.4.1 to 3.5.0
@@ -413,3 +413,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.xmlFormatter = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
if (node.children === null) { | ||
if (node.children === null || state.options.forceSelfClosingEmptyTag && node.children.length === 0) { | ||
var selfClosingNodeClosingTag = state.options.whiteSpaceAtEndOfSelfclosingTag ? ' />' : '/>'; // self-closing node | ||
@@ -416,0 +416,0 @@ |
@@ -413,3 +413,3 @@ require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
if (node.children === null) { | ||
if (node.children === null || state.options.forceSelfClosingEmptyTag && node.children.length === 0) { | ||
var selfClosingNodeClosingTag = state.options.whiteSpaceAtEndOfSelfclosingTag ? ' />' : '/>'; // self-closing node | ||
@@ -416,0 +416,0 @@ |
@@ -69,3 +69,3 @@ "use strict"; | ||
processAttributes(state, node.attributes); | ||
if (node.children === null) { | ||
if (node.children === null || (state.options.forceSelfClosingEmptyTag && node.children.length === 0)) { | ||
const selfClosingNodeClosingTag = state.options.whiteSpaceAtEndOfSelfclosingTag ? ' />' : '/>'; | ||
@@ -72,0 +72,0 @@ // self-closing node |
@@ -64,3 +64,3 @@ import xmlParser from 'xml-parser-xo'; | ||
processAttributes(state, node.attributes); | ||
if (node.children === null) { | ||
if (node.children === null || (state.options.forceSelfClosingEmptyTag && node.children.length === 0)) { | ||
const selfClosingNodeClosingTag = state.options.whiteSpaceAtEndOfSelfclosingTag ? ' />' : '/>'; | ||
@@ -67,0 +67,0 @@ // self-closing node |
@@ -44,2 +44,6 @@ import { XmlParserNode } from 'xml-parser-xo'; | ||
strictMode?: boolean; | ||
/** | ||
* True to force empty tags to be self-closing. | ||
*/ | ||
forceSelfClosingEmptyTag?: boolean; | ||
}; | ||
@@ -46,0 +50,0 @@ export declare type XMLFormatterMinifyOptions = Omit<XMLFormatterOptions, 'lineSeparator' | 'indentation'>; |
{ | ||
"name": "xml-formatter", | ||
"version": "3.4.1", | ||
"version": "3.5.0", | ||
"repository": "github:chrisbottin/xml-formatter", | ||
@@ -5,0 +5,0 @@ "bugs": { |
@@ -62,2 +62,5 @@ | ||
- default: `true` | ||
- `forceSelfClosingEmptyTag`: True to force empty tags to be self-closing. | ||
- type: `boolean` | ||
- default: `false` | ||
@@ -64,0 +67,0 @@ ### Usage: |
@@ -8,2 +8,3 @@ export type FormatOptions = { | ||
whiteSpaceAtEndOfSelfclosingTag?: boolean; | ||
forceSelfClosingEmptyTag?: boolean; | ||
} | ||
@@ -10,0 +11,0 @@ |
@@ -59,2 +59,7 @@ import xmlParser, { | ||
strictMode?: boolean; | ||
/** | ||
* True to force empty tags to be self-closing. | ||
*/ | ||
forceSelfClosingEmptyTag?: boolean; | ||
}; | ||
@@ -136,3 +141,3 @@ | ||
if (node.children === null) { | ||
if (node.children === null || (state.options.forceSelfClosingEmptyTag && node.children.length === 0)) { | ||
const selfClosingNodeClosingTag = state.options.whiteSpaceAtEndOfSelfclosingTag ? ' />' : '/>' | ||
@@ -139,0 +144,0 @@ // self-closing node |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
81384
1565
166