Check Yo Self CLI

Check Yo Self CLI

  • Introduction
  • API
  • Usage
  • Examples
  • GitHub
  • Blog

›Recent Posts

Recent Posts

  • Retiring Options to Roll Out an MVP
  • Spellcheck Module is a Go
  • Fleshing Out v.0.1

Spellcheck Module is a Go

August 15, 2018

Tiffany White

Tiffany White

Thanks to some help from the CodeNewbie Slack, I was able to get some clarification on my gnawing sense that the mess I had in the spellcheck.js module was unnecessary. I didn't really need to create or pass an array into the spell.check() function; I could just pass the input directly into that function.

In the end, I was given a better answer to my suspicion:

const spell = require('spell-checker-js');

module.exports = spellCheck = (input) => {
  spell.load('en');
  return spell.check(input);
};

module.exports.markdown = require('./lib/strip-markdown');

This is just feeding whatever text that is input into the spell checker library.

Another Point

Another thing mentioned was escaping all the markdown characters. I have a library for that from Remark called strip-markdown. Incorporating this bit into the library is straightforward:

const remark = require('remark');
const strip = require('strip-markdown');

remark()
  .use(strip)
  .process('Some _emphasis_, **importance**, and `code`.', function(err, file) {
    if (err) { throw err; }
    console.log(String(file));
  });

This is example code, but you can see that is pretty straightforward: chain some methods onto the remark instance method and go from there. I am still working out how I am going to process some of the text with this but it shouldn't be that hard.

Tweet
Recent Posts
  • Another Point
Check Yo Self CLI
Docs
Getting Started (or other categories)Guides (or other categories)API Reference (or other categories)
More
BlogGitHubStar
Copyright © 2018 Tiffany White