Web Development

Numeric Separators in JavaScript

Numeric Separators in JavaScript

  • June 16, 2021

Writing performant code is not enough as a developer. We need to ensure that it is readable as well. And it is rare that an API change in a language introduces readability. Numeric Separators are one such rare change. Why numeric Separators? Reading this takes a few seconds: Counting the...

Apply timeout to JavaScript Promises

Apply timeout to JavaScript Promises

  • June 10, 2021

JavaScript promises do not have any time associated with them. We can use a .then() function and wait until the promise is resolved or rejected. We can even await it, and either of those works if the async task finishes in a reasonable amount of time. But in the case...

Enforcing coding standards using husky pre-commit hooks

Enforcing coding standards using husky pre-commit hooks

  • June 5, 2021

Having consistency and enforcing coding standards becomes very important as an application scales. It becomes important to automate the process to ensure quality standards and make the application maintainable. ESLint and Prettier can be used to define these standards, but we also need a tool to enforce them. Husky provides...

Why does React state need a new object/array?

Why does React state need a new object/array?

  • May 25, 2021

If you have been using React for a while, you are familiar with how state update works. There are a lot of internal optimizations that React makes for faster rendering. One of the implementation details of the React internals is that it checks whether the given state object has actually...

Using utility types for transforming TypeScript types

Using utility types for transforming TypeScript types

  • May 20, 2021

TypeScript provides some built-in utility types that help facilitate transformations of types from one form to another. These utilities are available globally. They can be quite handy in various situations. TypeScript generics Before understanding the TypeScript utility types, it is important to understand type aliases and generics. You can create...

TypeScript: the difference between interface and type

TypeScript: the difference between interface and type

  • May 13, 2021

Once we start exploring TypeScript, we start using interfaces and types without really understanding the differences between them. I am guilty of doing that as well. It is simple to get started with them and keep using them. But, at some point, it becomes important to know the difference between...

Writing better conditional expressions in JavaScript

Writing better conditional expressions in JavaScript

  • March 30, 2021

Writing conditional expressions is pretty easy to do. But there is room for improvement in the way we have been doing it. And with the flexibility that JavaScript provides, we can replace conditionals with clean code by using some good practices. And it can lead to more maintainable code. Let...

Parsing and validating data in Python using Pydantic

Parsing and validating data in Python using Pydantic

  • March 23, 2021

The introduction of type hinting opened the gates for many great new features in Python. And data validation and parsing became easier to do with the use of type hints. Pydantic is one such package that enforces type hints at runtime. It throws errors, allowing developers to catch invalid data....