About the Author
Lou Mauget headshot

Lou Mauget

Lou Mauget has been writing code since 1961. He coded in ILLIAC I machine language before most of computing's defining moments had occurred. Born in 1942, he has worked across several layers of the stack. Since 2020, he continues to focus on React and TypeScript front-end development, bringing six decades of perspective to modern development.

Ai-Accelerated Unit Testing header image with Vitest and React Testing Library logos

AI-Generated Unit Tests: A Practical Workflow with Vitest and React

Lou Mauget Agentic AI & AI-Accelerated Development, Articles, Generative AI & LLMs, React, Testing, TypeScript Leave a Comment

AI-generated unit testing is changing how developers write tests. Learn a practical workflow for generating unit tests with tools like ChatGPT, Claude, and Copilot using React, TypeScript, and Vitest.

Dynamic Unit Conversions in Math.js

Using Math.js for Dynamic Unit Conversions

Lou Mauget Articles, Development Technologies & Tools, JavaScript Leave a Comment

In this post, Iโ€™ll survey a convenient JavaScript math.js library approach for converting a numeric value having a unit to a value for another unit. Iโ€™ll show how to convert a number associated with a unit to a value having another unit, add custom units and conversions, and evaluate textual expressions containing values with units. To wrap up, weโ€™ll walk through a few practical use cases.

By the end of this post, I hope you are inspired to use math.js in your projects. Itโ€™s a powerful tool in the right scenarios. With that, letโ€™s get started.

3D Geospatial Rendering with Cesium

CesiumJS 3D Geospatial Rendering

Lou Mauget Articles, Development Technologies & Tools, JavaScript, Programming, Tutorial Leave a Comment

This blog is a brief overview of CesiumJS, a cool JavaScript client library for visualizing a geospatial Earth map, including artifacts (both real and generated).ย They eat their own dog food, so their homepage has a declaratively-rendered spinning globe by Cesium.

CesiumJS has a higher-level Entity API as well as a lower-level Primitive API. The API doc can be found here. I’ll point out a couple of interactive source examples that use the entity API; most Cesium apps use it. Cesium also provides open specification 3D Tiles to load, render, and cache on-demand terrain features, artifacts, and building renditions for surface viewing.

There is no IDE or download needed to interact with the material mentioned in this overview. You can interact with the material mentioned with your browser.

better sort in JavaScript

Better Sort Ordering in JavaScript

Lou Mauget Articles, Development Technologies & Tools, JavaScript, Programming, Tutorial 2 Comments

In this post, I show how to cajole Array.sort() into producing the following order. This: [Item 1, Item 2, Item 100] instead of this…[Item 1, Item 100, Item 2].

The answer is to pass the sort function a comparator argument from the International Collator built into every major browser and Node.js. This approach is simple and declarative for lists of flat strings. The comparison function arguments default to each string being compared. For sorting objects such as a list of dropdown choices, just pass a pair of the sort field drill-downs to the comparison function.

Cancel a React Modal with Escape Key or External Click

Lou Mauget Articles, Development Technologies & Tools, React, Tutorial 1 Comment

Web application users are accustomed to canceling a popup (aka dialog or modal) by pressing the escape key, and many modals can even cancel if the user clicks outside it. How does a React developer code that without a plumbing mess between the modal and every visible component beneath it? How do you cancel a React modal with an escape key or external click?

I’m glad you asked because I have an answer. In this blog, Iโ€™ll show a pair of easy-to-use custom React hooks that simplify the task.