forked from sairion/svgcleaner-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
createArgs.js
67 lines (59 loc) · 3.63 KB
/
createArgs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// https://github.com/RazrFalcon/svgcleaner/blob/2cf52ab2ce2b005529f8470110e3f9c6bbd3c9cc/src/cli.rs
// svgcleaner cli v0.9.5
var argKeys = [
"remove-comments",
"remove-declarations",
"remove-nonsvg-elements",
"remove-unused-defs",
"convert-shapes",
"remove-title",
"remove-desc",
"remove-metadata",
"remove-dupl-lineargradient",
"remove-dupl-radialgradient",
"remove-dupl-fegaussianblur",
"ungroup-groups",
"ungroup-defs",
"group-by-style",
"merge-gradients",
"regroup-gradient-stops",
"remove-invalid-stops",
"remove-invisible-elements",
"resolve-use",
"remove-version",
"remove-nonsvg-attributes",
"remove-unreferenced-ids",
"trim-ids",
"remove-text-attributes",
"remove-unused-coordinates",
"remove-default-attributes",
"remove-xmlns-xlink-attribute",
"remove-needless-attributes",
"remove-gradient-attributes",
"join-style-attributes",
"apply-transform-to-gradients",
"apply-transform-to-shapes",
"remove-unresolved-classes",
"paths-to-relative",
"remove-unused-segments",
"convert-segments",
"trim-paths",
"join-arcto-flags",
"remove-dupl-cmd-in-paths",
"use-implicit-cmds",
"trim-colors",
"simplify-transforms",
"paths-coordinates-precision",
"indent",
"multipass",
"copy-on-error",
"quiet",
];
var argDict = argKeys.reduce((dict, key) => {
var cliArgKey = `--${key}`;
var convertedArgKey = key.replace(/[-|:]([a-z])/g, function (g) { return g[1].toUpperCase(); })
dict[convertedArgKey] = cliArgKey;
return dict;
}, {});
console.log(JSON.stringify(argDict));
// {"removeComments":"--remove-comments","removeDeclarations":"--remove-declarations","removeNonsvgElements":"--remove-nonsvg-elements","removeUnusedDefs":"--remove-unused-defs","convertShapes":"--convert-shapes","removeTitle":"--remove-title","removeDesc":"--remove-desc","removeMetadata":"--remove-metadata","removeDuplLineargradient":"--remove-dupl-lineargradient","removeDuplRadialgradient":"--remove-dupl-radialgradient","removeDuplFegaussianblur":"--remove-dupl-fegaussianblur","ungroupGroups":"--ungroup-groups","ungroupDefs":"--ungroup-defs","groupByStyle":"--group-by-style","mergeGradients":"--merge-gradients","regroupGradientStops":"--regroup-gradient-stops","removeInvalidStops":"--remove-invalid-stops","removeInvisibleElements":"--remove-invisible-elements","resolveUse":"--resolve-use","removeVersion":"--remove-version","removeNonsvgAttributes":"--remove-nonsvg-attributes","removeUnreferencedIds":"--remove-unreferenced-ids","trimIds":"--trim-ids","removeTextAttributes":"--remove-text-attributes","removeUnusedCoordinates":"--remove-unused-coordinates","removeDefaultAttributes":"--remove-default-attributes","removeXmlnsXlinkAttribute":"--remove-xmlns-xlink-attribute","removeNeedlessAttributes":"--remove-needless-attributes","removeGradientAttributes":"--remove-gradient-attributes","joinStyleAttributes":"--join-style-attributes","applyTransformToGradients":"--apply-transform-to-gradients","applyTransformToShapes":"--apply-transform-to-shapes","removeUnresolvedClasses":"--remove-unresolved-classes","pathsToRelative":"--paths-to-relative","removeUnusedSegments":"--remove-unused-segments","convertSegments":"--convert-segments","trimPaths":"--trim-paths","joinArctoFlags":"--join-arcto-flags","removeDuplCmdInPaths":"--remove-dupl-cmd-in-paths","useImplicitCmds":"--use-implicit-cmds","trimColors":"--trim-colors","simplifyTransforms":"--simplify-transforms","pathsCoordinatesPrecision":"--paths-coordinates-precision","indent":"--indent","multipass":"--multipass","copyOnError":"--copy-on-error","quiet":"--quiet"}