summaryrefslogtreecommitdiff
path: root/node_modules/svgo/lib/stringifier.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/svgo/lib/stringifier.js')
-rw-r--r--node_modules/svgo/lib/stringifier.js16
1 files changed, 6 insertions, 10 deletions
diff --git a/node_modules/svgo/lib/stringifier.js b/node_modules/svgo/lib/stringifier.js
index 26cff6c5..e50e723c 100644
--- a/node_modules/svgo/lib/stringifier.js
+++ b/node_modules/svgo/lib/stringifier.js
@@ -12,12 +12,12 @@
* @typedef {import('./types').StringifyOptions} StringifyOptions
*/
-const { textElems } = require('../plugins/_collections.js');
+const { textElems } = require('../plugins/_collections');
/**
* @typedef {{
* indent: string,
- * textContext: null | XastElement,
+ * textContext: ?XastElement,
* indentLevel: number,
* }} State
*/
@@ -33,9 +33,7 @@ const encodeEntity = (char) => {
return entities[char];
};
-/**
- * @type {Options}
- */
+/** @type {Options} */
const defaults = {
doctypeStart: '<!DOCTYPE',
doctypeEnd: '>',
@@ -58,16 +56,14 @@ const defaults = {
indent: 4,
regEntities: /[&'"<>]/g,
regValEntities: /[&"<>]/g,
- encodeEntity: encodeEntity,
+ encodeEntity,
pretty: false,
useShortTags: true,
eol: 'lf',
finalNewline: false,
};
-/**
- * @type {Record<string, string>}
- */
+/** @type {Record<string, string>} */
const entities = {
'&': '&amp;',
"'": '&apos;',
@@ -113,7 +109,7 @@ const stringifySvg = (data, userOptions = {}) => {
config.textEnd += eol;
}
let svg = stringifyNode(data, config, state);
- if (config.finalNewline && svg.length > 0 && svg[svg.length - 1] !== '\n') {
+ if (config.finalNewline && svg.length > 0 && !svg.endsWith('\n')) {
svg += eol;
}
return svg;