fix: declare default parameter values in xmlUtils.prettyXml (#181)
parent
1447fd29fc
commit
d33769fad5
|
@ -128,25 +128,20 @@ export const getXml = (node: Element, linefeed = '
'): string => {
|
||||||
*
|
*
|
||||||
* @param node DOM node to return the XML for.
|
* @param node DOM node to return the XML for.
|
||||||
* @param tab Optional string that specifies the indentation for one level.
|
* @param tab Optional string that specifies the indentation for one level.
|
||||||
* Default is two spaces.
|
|
||||||
* @param indent Optional string that represents the current indentation.
|
* @param indent Optional string that represents the current indentation.
|
||||||
* Default is an empty string.
|
* @param newline Optional string that represents a linefeed.
|
||||||
* @param newline Option string that represents a linefeed. Default is '\n'.
|
* @param ns Optional string that represents the target namespace URI.
|
||||||
*/
|
*/
|
||||||
export const getPrettyXml = (
|
export const getPrettyXml = (
|
||||||
node: Element,
|
node: Element | null,
|
||||||
tab: string,
|
tab = ' ',
|
||||||
indent: string,
|
indent = '',
|
||||||
newline: string,
|
newline = '\n',
|
||||||
ns: string
|
ns: string | null = null
|
||||||
): string => {
|
): string => {
|
||||||
const result = [];
|
const result = [];
|
||||||
|
|
||||||
if (node != null) {
|
if (node != null) {
|
||||||
tab = tab != null ? tab : ' ';
|
|
||||||
indent = indent != null ? indent : '';
|
|
||||||
newline = newline != null ? newline : '\n';
|
|
||||||
|
|
||||||
if (node.namespaceURI != null && node.namespaceURI !== ns) {
|
if (node.namespaceURI != null && node.namespaceURI !== ns) {
|
||||||
ns = node.namespaceURI;
|
ns = node.namespaceURI;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue