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.
About the Author
Using Math.js for Dynamic Unit Conversions
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.
CesiumJS 3D Geospatial Rendering
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 Ordering in JavaScript
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
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.





