Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return fromPromise(new Promise(resolve => {
const notepad: INotepad = Parser.notepad;
// Sort out assets
Parser.parseAssets(action.payload, async (assets: IAssets) => {
const notepadAssets = new Set((notepad.notepadAssets || []));
for (let i = 0; i < assets.assets.length; i++) {
if (!notepadAssets.has(assets.assets[i].uuid)) notepadAssets.add(assets.assets[i].uuid);
await ASSET_STORAGE.setItem(assets.assets[i].uuid, assets.assets[i].data);
}
notepad.notepadAssets = Array.from(notepadAssets);
resolve(notepad);
});
}));
}),