Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
svg.map(({ name, content }) => new Promise((resolve, reject) => {
svg2js(content, (result) => resolve({
name,
content: addStyleJSXAttribute(result, component)
}));
})));
self.addEventListener('message', e => {
const { svg } = e.data;
svg2js(svg, parsedSvg => {
if (parsedSvg.error) {
throw Error(parsed.error);
}
const svg = cloneParsedSvg(parsedSvg);
let cleanSvg;
plugins(svg, {input: 'string'}, optimisedPluginsData);
cleanSvg = js2svg(svg, { indent: ' ' }).data;
self.postMessage(cleanSvg);
});
});
load({ data }) {
svg2js(data, p => parsedSvg = p);
if (parsedSvg.error) throw Error(parsedSvg.error);
return getDimensions(parsedSvg);
},
process({ settings }) {
return value => new Promise((resolve, reject) => {
svg2js(value, (svg) => {
if (svg.error) {
reject(new Error(normalizeErrorString(svg.error)));
return;
}
plugins(svg, opts);
const jsx = js2svg(svg, {
indent: ' ',
pretty: true,
}).data;
resolve(jsx);
});
});
};