MCPcopy Create free account
hub / github.com/neplextech/vectorizer / buildVectorizeConfig

Function buildVectorizeConfig

cli/index.mjs:154–189  ·  view source on GitHub ↗
(options, command)

Source from the content-addressed store, hash-verified

152}
153
154function buildVectorizeConfig(options, command) {
155 const hasCustomConfig = [
156 'colorMode',
157 'hierarchical',
158 'filterSpeckle',
159 'colorPrecision',
160 'layerDifference',
161 'mode',
162 'cornerThreshold',
163 'lengthThreshold',
164 'maxIterations',
165 'spliceThreshold',
166 'pathPrecision',
167 ].some((name) => command.getOptionValueSource(name) === 'cli');
168
169 if (!hasCustomConfig) {
170 return resolveVectorizePreset(options.preset);
171 }
172
173 const config = {
174 colorMode: parseColorMode(options.colorMode),
175 hierarchical: parseHierarchical(options.hierarchical),
176 filterSpeckle: options.filterSpeckle ?? 4,
177 colorPrecision: options.colorPrecision ?? 8,
178 layerDifference: options.layerDifference ?? 16,
179 mode: parsePathMode(options.mode),
180 cornerThreshold: options.cornerThreshold ?? 60,
181 lengthThreshold: options.lengthThreshold ?? 4,
182 maxIterations: options.maxIterations ?? 10,
183 spliceThreshold: options.spliceThreshold ?? 45,
184 pathPrecision: options.pathPrecision ?? 2,
185 };
186
187 Object.keys(config).forEach((key) => config[key] === undefined && delete config[key]);
188 return config;
189}
190
191function buildOptimizeOptions(options, prefix = '') {
192 const preset = prefix ? options[`${prefix}Preset`] : options.preset;

Callers 1

runVectorizeCommandFunction · 0.85

Calls 4

resolveVectorizePresetFunction · 0.85
parseColorModeFunction · 0.85
parseHierarchicalFunction · 0.85
parsePathModeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…