(options, command)
| 152 | } |
| 153 | |
| 154 | function 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 | |
| 191 | function buildOptimizeOptions(options, prefix = '') { |
| 192 | const preset = prefix ? options[`${prefix}Preset`] : options.preset; |
no test coverage detected
searching dependent graphs…