How to use the spellchecker.checkSpelling function in spellchecker

To help you get started, we’ve selected a few spellchecker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github box / box-openapi / tests / helpers / spellChecker.js View on Github external
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)
    })
  })
github figma / figma-api-demo / spellchecker / app.ts View on Github external
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 += '???'
        }