Web Tools #500 - assert(), Frameworks, JS Utils, Uncats

Web Tools Weekly
WEB VERSION
Tools for Web Developers

Issue #500 • February 16, 2023

Advertisement

The New Tab Page You’ll Actually Use
Ah, the hyperlink. It’s the single coolest thing on the web. There wouldn’t really be a web without it. Links are awesome. And they are even better in lists. A Fine Start makes every new tab a tidy, organized list of your favorite links.

A Fine Start

Minimal typographic design. Simple, effective grouping and sorting. Light mode and dark mode. It's fast and it’s free. Ditch the noise. Unleash the hyperlink. Grab the free browser extension.

For the longest time, when debugging apps, many JavaScript developers have made use of something referred to as an assert() function. There's no native assert() method in JavaScript. Node.js offers a similar feature called an assertion module, so you might be familiar with that if you're a Node developer.

For JavaScript in the browser, the easiest way to use assert() is by means of console.assert(), which is one of the methods available in the Console API. Of course, you can roll your own assert method, which isn't too hard, but console.assert() works pretty well for most cases.

The purpose of assert() is to determine whether a given expression is true or false. An example looks as follows:

const errorMsg = "Value is not an even number.",
      myNums = [1, 2, 3, 4, 5];

for (i of myNums) {
  console.log(`Number is ${i}`);
  console.assert(i % 2 === 0, "%o"{ myNums, errorMsg });
}

Here I'm simply iterating through an array of predefined numbers. The line with console.assert() will display the string along with the two values in the object in the console each time the assert fails. These will appear in red, just like any errors in the console.

The assert only shows in the console if some predefined condition has failed. In this case I'm using the modulus (or remainder) operator to see if the current number is an even number.

You can try the above example in this CodePen. You'll have to open your browser's console because asserts don't work in CodePen's console. Notice the loop displays a message for each number logged but the odd numbers also include the red error message executed by the assert.

The assert() method's first argument is the assertion. This should be some kind of expression that evaluates to either true or false. Passing or failing this will tell the method whether or not to log anything.

The remaining arguments can either be a list of one or more objects (to examine for debugging purposes) or a string containing substitutions, followed by one or more objects to substitute. In the above example, I'm writing a string that contains an object substitution. The final object with two values will be the one substituted for "%o" each time the assert fails.

Just to be a little more clear on the arguments, here's a simple assert example that doesn't use substitutions or objects:

console.assert(undefined, "Value is undefined");

In this case I'm forcing the first argument into a "false" state by simply using the value undefined. The next argument is a string that will output in the console in red, just like any error in the console. In this case, no objects are shown in the console, and there are no substitutions. Thus, this message is not that helpful outside of telling you the expression evaluates to false.

Admittedly, I've glossed over the use of substitutions when using assert(), but you can read up a little more on that concept on the Examples section of MDN's article on console.assert() and in MDN's article on the Console API, which has a section on substitutions.

Now on to this week's tools!
 

Web Frameworks

Nexth
An opinionated Next.js + Ethereum starter kit to quickly ship Web3 Apps, with Chakra UI, wagmi, ConnectKit, and more.

Svelte Headless-UI
An unofficial implementation of Tailwind HeadlessUI (the Tailwind component library for React and Vue) for Svelte.

The New Tab Page You’ll Actually Use
Text links on every new tab. Drag-n-drop grouping and sorting. Fast, free, and available for Chrome, Firefox, and Edge.   SPONSORED  

Tailwind Elements
A set of 500+ Bootstrap components recreated with Tailwind CSS, but with better design and more functionality.

SUID
A port of Material-UI (aka MUI, the popular React component library) for SolidJS.

Fest
A SaaS boilerplate built with Node.js and React that includes user auth, org management, and more.

Sailboat UI
A modern UI component library for Tailwind that includes 150+ open-source components and the components are searchable by name in the docs.

Sailboat UI<

Mamba UI
A free, open-source collection of 100+ UI components and templates based on Tailwind CSS, with code examples for HTML, Vue, and JSX-based apps.

next-apollo-joy-starter
An opinionated starter kit for creating fully typed Next.js apps, that includes NextAuth.js, Apollo GraphQL, i18next, and lots more.

Flowbite Vue
A UI component library for Vue projects, powered by Flowbite and built with Tailwind CSS.

React Email
A collection of high-quality, unstyled components for creating beautiful emails using React and TypeScript.

a2000
A UI library designed to capture the feel of the early web (i.e. Windows 2000-esque styles), while employing modern UX and web practices.

ecommerce-fastapi-stripe
An open-source mini e-commerce project, powered by FastAPI and Stripe, that loads products from JSON files saved in the templates directory (no database required) and uses a decent UI for page styling.
 

The Uncategorizables

He3
A free native cross-platform app that includes an all-in-one modern toolbox for developers with all sorts of little utilities, code converters, etc., for everyday tasks.

SEOfie
An online collection of SEO tools that includes tools for YouTube, text analysis, website tracking, and website management.

Indiekit
A Node.js server with all the parts needed to publish content to your personal website and share it on social networks.

Data is the Lifeblood of Modern Businesses
What are the most common mistakes companies make when it comes to managing and protecting sensitive user data? Read the guide now to learn how to move fast without breaking privacy.   SPONSORED  

Tolgee
A developer and translator-friendly web-based localization platform that's free for open-source projects on small to medium teams.

LocalSend
An open-source app for multiple mobile platforms that allows you to share files to nearby devices easily.

Databar
Access hundreds of APIs without writing a single line of code. Download custom datasets on finance, sports, and more in just a few clicks.

Databar

Plus
Build dashboards, connect apps, and share data without sharing logins and zero technical setup. Free for teams and individuals during the public beta.

Score
An open-source, developer-centric and platform-agnostic workload specification that ensures consistent configuration between local and remote environments.

Fancy Macbook App
A useful online tool to select and generate the CLI command needed to 'brew install' all your apps on a new Mac.

LinksforAll
An open-source option to set up your own bio links page, with optional category filtering and dark and light themes.

activepieces
An open-source alternative to Zapier, the business automation platform, to automate your work for free and without writing code, while your data stays on your machine.
 

JavaScript Utilities

nano-memoize
A small (780 Brotli bytes) and fast memoization utility for single and multiple argument functions.

Superdiff
A utility to compare two arrays or objects and return a complete diff of their differences in a readable format.

Mapkick.js
Create beautiful, interactive maps with one line of JavaScript, with support for Mapbox and MapLibre.

Data is the Lifeblood of Modern Businesses
What are the most common mistakes companies make when it comes to managing and protecting sensitive user data? Read the guide now to learn how to move fast without breaking privacy.   SPONSORED  

FeedbackPlus
An open-source JavaScript library that allows you to add screenshot taking and screenshot editing functionality to your feedback forms. This comes in handy where you want the user to take a screenshot of something when reporting an issue.

Domain Functions
Decouple your business logic from your controllers, with first-class type inference from end to end, by enforcing the parameters' types at runtime.

query-string
A utility to parse and stringify URL query strings with a number of different options available in an easy-to-use API.

simple-gpu
A utility that simplifies WebGPU programming by removing as much shared state as it can get away with by replacing the WebGPU API with two abstractions.

Taxi.js
A small and fast JavaScript library for adding slick PJAX (pushState + Ajax) navigation and beautiful transitions to your website.

TinyColor
A small, dependency-free library for color manipulation and conversion in JavaScript that allows multiple forms of input, while providing conversions and other color utility functions.

TinyColor

Typia
A Super-fast runtime validator (type checker), written in TypeScript, with all functions requiring only a single line of code.

winkNLP
A JavaScript library for natural language processing (NLP), designed to make development of NLP applications easier and faster.
 

Commercial Apps and Classifieds

These are commercial apps, affiliate links, PPC ads, and paid classifieds. Submit yours!
FigPilot – A Figma plugin to convert any Figma design to Chakra UI, the popular React UI library.
Bytes – A JavaScript newsletter that's entertaining and informative for all levels of developers.   AD
Kernex – A Cloud Headless CMS with file storage, CDN, and a JavaScript client.
supastarter – A SaaS template for Next.js and Supabase with auth, i18n, subscriptions, blog, mail templates, and more.
Emerging Tech Brew – A 3-times-a-week newsletter with the latest tech news impacting you and your future. AD
WP-Stack – A multi-featured platform to manage and maintain multiple WordPress sites.
Daftpage – A fun, next-generation website builder that works like Notion.

A Tweet for Thought

If you're a fan of the movie Home Alone, you'll enjoy this thread from freelance writer Sean Kelly, where he debunks many of the supposed "plot holes" in the film. I'm almost ashamed to admit I've never actually watched the movie, but the thread made me want to give it a go! 😂
 
A Tweet for Thought
 

Send Me Your Tools!

Made something? Send links via Direct Message on Twitter @WebToolsWeekly (details here). No tutorials or articles, please. If you have any suggestions for improvement or corrections, feel free to reply to this email.
 

Before I Go...

As you may have noticed, this is issue #500 of Web Tools Weekly. Amazing! I'm glad I've been able to keep up this project for all these years (almost 10 now!). And I'm happy I have a strong and engaged subscriber base.

To celebrate issue 500, here's one of my favourite songs of all time, from 1992: 500 Up by the Canadian alt-rock band Sloan. The low-budget video is also quite amusing featuring a plastic duck driving around in a Barbie car. 😂 If you're outside of Canada and have never heard of Sloan, just imagine the Pixies and Teenage Fanclub had a baby! (Although in their later years Sloan has been closer to 60s/70s rock).

Thanks to everyone for subscribing and reading!

Keep tooling,
Louis
@WebToolsWeekly
PayPal.me/WebToolsWeekly

Older messages

Web Tools #499 - JS Libraries, Git/CLI Tools, React

Thursday, February 9, 2023

Web Tools Weekly WEB VERSION Issue #499 • February 9, 2023 Advertisement Practical, No-nonsense UI Design Tips 🔥 If you do any design work, you might struggle to find actually practical UI advice that

Web Tools #498 - CSS Tools, Testing, SVG/Media

Thursday, February 2, 2023

Web Tools Weekly WEB VERSION Issue #498 • February 2, 2023 Advertisement Nothing Beats the Hyperlink Old school hyperlinks are the best. They were born with the web, and they will always be here. A

Web Tools #497 - JS Utilities, Git/CLI Tools, Uncats

Thursday, January 26, 2023

Web Tools Weekly WEB VERSION Issue #497 • January 26, 2023 Advertisement The Fast Way for Developers to Build Mobile Apps Build native iOS and Android apps with no mobile expertise—all you need is JS

Web Tools #495 - CodePen, CSS, Bundlers, Media (SVG, etc.)

Friday, January 20, 2023

Web Tools Weekly WEB VERSION Issue #495 • January 12, 2023 Advertisement JavaScript & DOM Tips E-Books Bundle My JavaScript E-Books bundle now includes a new volume! Get all 4 e-books containing

Web Tools #496 - JS Libraries, JSON/DB, Vue Tools

Friday, January 20, 2023

Web Tools Weekly WEB VERSION Issue #496 • January 19, 2023 Advertisement Measure the Success of Your Components 📊 Hot out the oven! Omlet is a code-based component analytics product to help frontend

You Might Also Like

WebAIM November 2024 Newsletter

Friday, November 22, 2024

WebAIM November 2024 Newsletter Read this newsletter online at https://webaim.org/newsletter/2024/november Features Using Severity Ratings to Prioritize Web Accessibility Remediation When it comes to

➡️ Why Your Phone Doesn't Want You to Sideload Apps — Setting the Default Gateway in Linux

Friday, November 22, 2024

Also: Hey Apple, It's Time to Upgrade the Macs Storage, and More! How-To Geek Logo November 22, 2024 Did You Know Fantasy author JRR Tolkien is credited with inventing the main concept of orcs and

JSK Daily for Nov 22, 2024

Friday, November 22, 2024

JSK Daily for Nov 22, 2024 View this email in your browser A community curated daily e-mail of JavaScript news React E-Commerce App for Digital Products: Part 4 (Creating the Home Page) This component

Spyglass Dispatch: The Fate of Chrome • Amazon Tops Up Anthropic • Pros Quit Xitter • Brave Powers AI Search • Apple's Lazy AI River • RIP Enrique Allen

Friday, November 22, 2024

The Fate of Chrome • Amazon Tops Up Anthropic • Pros Quit Xitter • Brave Powers AI Search • Apple's Lazy AI River • RIP Enrique Allen The Spyglass Dispatch is a free newsletter sent out daily on

Charted | How the Global Distribution of Wealth Has Changed (2000-2023) 💰

Friday, November 22, 2024

This graphic illustrates the shifts in global wealth distribution between 2000 and 2023. View Online | Subscribe | Download Our App Presented by: MSCI >> Get the Free Investor Guide Now FEATURED

Daily Coding Problem: Problem #1616 [Easy]

Friday, November 22, 2024

Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Alibaba. Given an even number (greater than 2), return two prime numbers whose sum will

The problem to solve

Friday, November 22, 2024

​ Use problem framing to define the problem to solve This week, Tom Parson and Krishna Raha share tools and frameworks to identify and address challenges effectively, while Voltage Control highlights

Issue #568: Random mazes, train clock, and ReKill

Friday, November 22, 2024

View this email in your browser Issue #568 - November 22nd 2024 Weekly newsletter about Web Game Development. If you have anything you want to share with our community please let me know by replying to

Whats Next for AI: Interpreting Anthropic CEOs Vision

Friday, November 22, 2024

Top Tech Content sent at Noon! How the world collects web data Read this email in your browser How are you, @newsletterest1? 🪐 What's happening in tech today, November 22, 2024? The HackerNoon

iOS Cocoa Treats

Friday, November 22, 2024

View in browser Hello, you're reading Infinum iOS Cocoa Treats, bringing you the latest iOS related news straight to your inbox every week. Using the SwiftUI ImageRenderer The SwiftUI ImageRenderer