From f06956efd2dc4bf77244a9fcce2b883a00b925af Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Thu, 21 Dec 2023 22:46:53 +0800 Subject: updated node modules --- node_modules/svgo/lib/stringifier.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'node_modules/svgo/lib/stringifier.js') 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: '', @@ -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} - */ +/** @type {Record} */ 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; -- cgit v1.2.3