Tag:javascript

I wrote an ORM for SQLite

It starts with inter-op with mongoose, and inspired from Typegoose.

It is an ORM that

  • Can query by Mongo-like query
  • Auto-convert back-and-forth for JSON <=> TEXT, Date <=> INTEGER and Boolean <=> INTEGER

For Mongo-like query, it can be tested here -- https://q2search.herokuapp.com/LiteORM (The actual Mongo-like query is in the console)

How do I create an SEO-friendly URL?

In my understanding,

  • Create a human readable URL
  • Shorten the URL, like 60 words, including location.origin
  • Only - punctuation is preferred

Share your .eslintrc, auto-fix on save, and related config files

Do you know that Visual Studio Code itself can auto-fix your code on save, to be compatible with linting rules.

Currently, I auto-fixes TypeScript, JavaScript, Vue, Markdown files.

For TypeScript, JavaScript, Vue; I simply use ESLint (there is TSLint, but it is becoming deprecated). VSCode ESLint might also be required

For Markdown, it is a little different. I use VSCode MarkdownLint to auto-fix on save.

Creating an NPM repo with browser version, and also with testing and linting

This can be done by setting up,

  • Multiple tsconfig.json
  • /browser.ts compiled by Parcel.js to /umd/index.min.js
  • ESLint, with eslint --init
  • Testing, with ts-mocha

So, the project is basically like this,

What is a best way to organize Test Suites / Test Cases in JavaScript?

  • Do you put test cases in JSON / YAML or in separate JavaScript files?
  • What keys do you put for each cases, such as Name, Assertion, Result?
  • Do you print, i.e. console.log / console.dir(..., {depth: null}), results?
  • Do you write "expect to fail" tests?