Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const enhancers = [
editsType === 'none' ? null : markEdits(hunks, {type: editsType}),
markWord('\r', 'carriage-return', '␍'),
markWord('\t', 'tab', '→'),
];
const options = {
highlight: language !== 'text',
refractor: refractor,
language: language,
oldSource: oldSource,
enhancers: compact(enhancers),
};
try {
const tokens = tokenize(hunks, options);
const payload = {
success: true,
tokens: tokens,
};
self.postMessage({id, payload});
}
catch (ex) {
const payload = {
success: false,
reason: ex.message,
};
self.postMessage({id, payload});
}
}
);