@cyberalien/svg-utils 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/xml/stringify.d.ts +1 -0
- package/lib/xml/stringify.js +5 -2
- package/package.json +1 -1
package/lib/xml/stringify.d.ts
CHANGED
package/lib/xml/stringify.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const defaultOptions = {
|
|
2
2
|
useSelfClosing: true,
|
|
3
3
|
numberTemplate: ` {key}="{value}"`,
|
|
4
|
-
prettyPrint: false
|
|
4
|
+
prettyPrint: false,
|
|
5
|
+
sortAttributes: false
|
|
5
6
|
};
|
|
6
7
|
function assertNever(v) {}
|
|
7
8
|
/**
|
|
@@ -19,7 +20,9 @@ function stringifyXMLContent(root, options) {
|
|
|
19
20
|
const nl = prettyPrint === false ? "" : "\n";
|
|
20
21
|
const add = (node, depth) => {
|
|
21
22
|
output += tabs(depth) + "<" + node.tag;
|
|
22
|
-
|
|
23
|
+
const keys = Object.keys(node.attribs);
|
|
24
|
+
if (fullOptions.sortAttributes) keys.sort();
|
|
25
|
+
for (const key of keys) {
|
|
23
26
|
const value = node.attribs[key];
|
|
24
27
|
switch (typeof value) {
|
|
25
28
|
case "string":
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Common functions for working with SVG used by various packages.",
|
|
5
5
|
"author": "Vjacheslav Trushkin",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.5",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"bugs": "https://github.com/cyberalien/svg-utils/issues",
|
|
9
9
|
"homepage": "https://cyberalien.dev/",
|