Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
remark().use(strip).process(item.value, (error, result) => {
if (error) { reject(error) }
item.plain_value = String(result).replace(/\n/g, " ").trim()
item.checks = checker.checkSpelling(item.plain_value)
resolve(item)
})
})
textNodes.forEach(node => {
const misspelledWords = spellchecker.checkSpelling(node.characters)
.map((error: ErrorRange) => {
return node.characters.slice(error.start, error.end)
});
if (misspelledWords.length > 0) {
let annotation = 'You may have several misspellings.\n\n';
misspelledWords.forEach((word: string) => {
annotation += `${word} -> `;
const corrections = spellchecker.getCorrectionsForMisspelling(word);
if (corrections.length > 0) {
annotation += corrections.slice(0, 3).join(', ')
} else {
annotation += '???'
}