diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2023-12-21 22:46:53 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2023-12-21 22:46:53 +0800 |
| commit | f06956efd2dc4bf77244a9fcce2b883a00b925af (patch) | |
| tree | 0123cb73ce67f1f4b17e1d6cbabff076ee44e31b /node_modules/svgo/lib/stringifier.js | |
| parent | 8d980c13970c15b6d2312b6fc4ac51698dd0d220 (diff) | |
updated node modules
Diffstat (limited to 'node_modules/svgo/lib/stringifier.js')
| -rw-r--r-- | node_modules/svgo/lib/stringifier.js | 16 |
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 = { '&': '&', "'": ''', @@ -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; |
