Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getNativeLayer(failingLayers, layer) {
// debug
// console.log('Processing ' + layer.name + ' (' + layer._class + ')');
if (layer._class === 'text') {
fixTextLayer(layer);
} else if (layer._class === 'svg') {
fixSVGLayer(layer);
} else if (layer._class === 'bitmap') {
fixBitmap(layer);
} else {
fixImageFillsInLayer(layer);
}
// Create native object for the current layer, ignore the children for now
// this alows us to catch and ignore failing layers and finish the import
const children = layer.layers;
let nativeObj = null;
layer.layers = [];
try {
nativeObj = fromSJSONDictionary(layer);
} catch (e) {
failingLayers.push(layer.name);