fix: declare default parameter values in xmlUtils.prettyXml (#181)

development
Thomas Bouffard 2023-03-05 12:03:24 +01:00 committed by GitHub
parent 1447fd29fc
commit d33769fad5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 12 deletions

View File

@ -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;