MCPcopy
hub / github.com/svg/svgo / stringifyAttributes

Function stringifyAttributes

lib/stringifier.js:270–283  ·  view source on GitHub ↗
(node, config)

Source from the content-addressed store, hash-verified

268 * @returns {string}
269 */
270const stringifyAttributes = (node, config) => {
271 let attrs = '';
272 for (const [name, value] of Object.entries(node.attributes)) {
273 attrs += ' ' + name;
274
275 if (value !== undefined) {
276 const encodedValue = value
277 .toString()
278 .replace(config.regValEntities, config.encodeEntity);
279 attrs += config.attrStart + encodedValue + config.attrEnd;
280 }
281 }
282 return attrs;
283};
284
285/**
286 * @param {import('./types.js').XastText} node

Callers 1

stringifyElementFunction · 0.85

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected