Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.getMisspellings = (document, filePath) => SpellChecker.checkSpellingAsync(document)
.then((indices) => {
const filteredIndices = isMarkdown(filePath) ?
filterIndicesAndWords(indices, document) :
filterWords(indices, document);
const misspellings = filteredIndices.map(({ start, end }) => document.substring(start, end));
const allSuggestions = misspellings.map(SpellChecker.getCorrectionsForMisspelling);
const misspellingObjects = _.zipWith(
filteredIndices,
misspellings,
allSuggestions,
(index, misspelling, suggestions) => ({
index,
misspelling,
suggestions,
})
);