Web Tools #393 - JS Utilities, Testing Tools, Jamstack

Web Tools Weekly
WEB VERSION
Tools for Web Developers

Issue #393 • January 28, 2021

Advertisement
The Free Modern Jira Alternative for Teams
Tara AI is the simplest free product development tool, designed for teams moving rapidly. One workspace for your team's docs, sprints and tasks, synced to Git.
Sign up for free
Tara AI

A relatively new array method that the ECMAScript specification added in ES2016, and has strong browser support, is the simple to use but practical Array.flat().

Array.flat() allows you to flatten any array that has nested array items (or elements in one or more sub-arrays). For example:

let myArray = ['one', 'two', [1, 2, 3], 'three', 'four', 'five', [4, 5, 6], 'six'];

console.log(myArray.flat());

// ["one", "two", 1, 2, 3, "three", "four", "five", 4, 5, 6, "six"]

Try it on CodePen

As you can see, the original array has two different sub-arrays. When I call myArray.flat(), the entire array gets converted to a single-level (i.e. flat) array. This method doesn't change the original array, but returns a new flat array.

Array.flat() additionally takes an optional argument, an integer, that defines how deep the array should be flattened. The default is 1, which means 'flatten one sub-array down'.

A few code examples should help you grasp how this works:

let myArray = ['one', 'two', [1, 2, ['a', 'b', 'c'], 3], 'three', 'four', 'five', 'six'];

console.log(myArray.flat(1));
// ["one", "two", 1, 2, ["a", "b", "c"], 3, "three", "four", "five", "six"]

console.log(myArray.flat(0));
// "one", "two", [1, 2, ["a", "b", "c"], 3], "three", "four", "five", "six"]

console.log(myArray.flat(2));
// ["one", "two", 1, 2, "a", "b", "c", 3, "three", "four", "five", "six"]

console.log(myArray.flat(3));
// ["one", "two", 1, 2, "a", "b", "c", 3, "three", "four", "five", "six"]

Try it on CodePen

As you can see, this time the original array has a sub-array with another sub-array nested inside that sub-array. Here's how the different argument values respond:

  • Calling myArray.flat() with the default argument of 1 flattens only the first two levels of the array, leaving the sub-sub-level intact.
  • Using 0 as the argument flattens nothing
  • Using an argument of 2 flattens both sub-levels to a single flat array
  • Using 3 or higher has the same effect as 2 since it doesn't go any deeper in this instance
As MDN points out, if you don't know how many levels deep the array goes, you can use Array.flat(Infinity) if you want to flatten the whole thing.
That's Array.flat() in a nutshell and it's safe to use in all modern browsers.
 

Now on to this week's tools!

JavaScript Utilities

The Free Modern Jira Alternative for Teams
Tara AI is the simplest free product development tool, designed for teams moving rapidly. One workspace for your team's docs, sprints and tasks, synced to Git. sponsored 

Okie
Utility for an API to run a dead simple worker threads pool.

Typesense
An open source, typo tolerant search experience for your pages that includes instant search, auto-suggest, faceted search, and more.

Pikaday
A refreshing JavaScript date picker – lightweight, no dependencies, and modular CSS.

Filterizr
A JavaScript library that searches, sorts, shuffles and applies stunning filters over responsive galleries using CSS transitions.

Filterizr

JavaScript Keyboard Events
An all-in-one online interactive demo that shows info on keypress, keydown, and keyup events when using a physical keyboard.

EasyGrid
Fully customizable vanilla JavaScript responsive grid with no need for a CSS framework and includes a filter feature.

Email Validator
Validates email addresses based on regex, common typos, disposable email blacklists, DNS records, and SMTP server response.

Detect GPU
Classifies GPUs based on their 3D rendering benchmark score, allowing the developer to provide sensible default settings for graphic intensive apps. Like a user-agent detection for the GPU but more powerful.

ActiveJS
Pragmatic, reactive state management for JavaScript apps featuring a simpler API and features like undo/redo, persistence, immutability, and observable events.

luciascript
Hastscript-like utility to create HTML strings.

next-translate
A Next.js plugin + internationalization API to keep the translations as simple as possible in a Next.js environment.

ON THE RELEASE RADAR:

Testing and Debugging Tools

Source Map Visualization
Upload a CSS or JS source map file (i.e. one with proper source map commenting) to see an interactive visualization of your source map data.

MSW
A seamless API mocking library for the browser and Node. Mock by intercepting requests on the network level. Seamlessly reuse the same mock definition for testing, development, and debugging.

deno-puppeteer
A fork of Puppeteer running on Deno.

slowbug
A VS Code extension for debugging your code in slow-mo, as an alternative to stepping through multiple breakpoints.

HostedScan
Service for 24/7 alerts and detection for security vulnerabilities on your website or app, including a pretty good free tier.
 
HostedScan

EStimator.dev
Enter a website URL and this tool will tell you how much performance could be improved by converting old JavaScript to modern ES features.

Firefox Profiler
A web app for Firefox performance analysis. Capture a performance profile, analyze it, and share it.

Playwright CLI
CLI for common Playwright actions. Record and generate Playwright code, inspect selectors and take screenshots.

markdown-link-check
Extracts links from markdown text and check whether each link is alive (200 OK) or dead, including mailto: links.

web-vitals
A tiny (~1K), modular library for measuring Google's Web Vitals metrics on real users, in a way that matches how they're measured by Chrome and reported to other Google tools.
 

Jamstack, Site Builders, etc.

gatsby-themes
High-quality, open-source, and customizable Gatsby themes to quickly bootstrap your website.

Lume
A static site generator for Deno with support for multiple file formats (MD, YAML, etc.) and ability to hook any pre- or post-processor (Sass, PostCSS, etc).

Stork Search
Fast web search, made for static sites. Add a beautiful, fast, and accurate search interface to your static site. The on-page demo works great!

11ty Sass Skeleton
Starter kit with nothing beyond a base HTML5 template and the essential setup to watch and compile your Sass alongside Eleventy.

Jamstack.new
Kind of like Google's sheets.new and docs.new, which instantly create sheets/docs. This one helps you quickly build a Jamstack site via Stackbit.
 
Jamstack.new

next-cms-ghost
Create and publish fast blogs with this Jamify blogging system. Powered by React and Next.js and content fed by headless Ghost.

Nextein
A static site and blog generator that combines the simplicity of Markdown and the power of Next.js.

Motionless
A static site generator using plain JavaScript and HTML with Node. No special templating or config language to learn, just load plain HTML files and use querySelector and the DOM API to change pages using JavaScript.

11ty Netlify Jumpstart
Quickly launch an Eleventy-generated static site that includes a minimal Sass framework, generated sitemap, RSS feed, and social share preview images.

Jamstack Explorers
A learning platform for building sites using Jamstack technologies via Netlify.

Hashnode
A developer/tech blogging platform that seems to be garnering some interest in the community.

A Tweet for Thought

We need more honesty like this, not only in tech, but everywhere.

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...

Dimensions is described as "a comprehensive reference database of dimensioned drawings documenting the standard measurements and sizes of the everyday objects and spaces that make up our world." Nicely designed, kind of like a Wikipedia for visuals. Might come in handy if you're designing or drawing everyday objects.

Thanks to everyone for subscribing and reading!

Keep tooling,
Louis
@WebToolsWeekly

Support This Newsletter:
PayPal.me  Patreon  GitHub Sponsors  E-Books  Advertise

Older messages

Web Tools #392 - CSS Tools, VS Code & IDEs, Build Tools

Thursday, January 21, 2021

Web Tools Weekly WEB VERSION Issue #392 • January 21, 2021 In case you missed it back in November, Addy Osmani wrote about a new unofficial specification called the JavaScript Self-Profiling API. This

Web Tools #391 - JS Libraries, JSON/DB, Uncategorizables

Friday, January 15, 2021

Web Tools Weekly WEB VERSION Issue #391 • January 14, 2021 Advertisement Preflect Surveys Websites of all types use Preflect to create fast on-site surveys. Learn more about your visitors, optimize for

Web Tools #390 - Frontend Frameworks, Testing Tools, Media

Thursday, January 7, 2021

Web Tools Weekly WEB VERSION Issue #390 • January 7, 2021 Promotion Frontendor UI Library A UI library to build beautiful and professional landing pages. Includes 100+ UI Blocks & 6+ Templates. Add

Web Tools #389 - Top 30 Tools of 2020

Thursday, December 31, 2020

Web Tools Weekly WEB VERSION Issue #389 • December 31, 2020 As mentioned last week, this issue is the second part in the countdown of most clicked tools. This week features the 30 most-clicked tools in

Web Tools #388 - Top Tools of 2020 (Pt. 1)

Thursday, December 24, 2020

Web Tools Weekly WEB VERSION Issue #388 • December 24, 2020 This week and next week are down weeks work-wise for many of you, so these two issues will feature this newsletter's 60 most clicked

You Might Also Like

WP Weekly 226 - Launches - New Elementor Theme, WP 6.8 in April 2025, Automattic Scale Back

Monday, January 13, 2025

Read on Website WP Weekly 226 / Launches 2025 has just started, and there is a slew of new launches like Hello Biz Theme, Meta Box Lite, FooConvert, Affililink, and more. Also, the next WordPress 6.8

SRE Weekly Issue #459

Monday, January 13, 2025

View on sreweekly.com A message from our sponsor, incident.io: Effective incident management demands coordination and collaboration to minimize disruptions. This guide by incident.io covers the full

Saving One Screen At A Time 🖥️

Monday, January 13, 2025

Why the screen saver stopped being so in-your-face. Here's a version for your browser. Hunting for the end of the long tail • January 12, 2025 Today in Tedium: Having seen a lot of pipes, wavy

Software Testing Weekly - Issue 253

Monday, January 13, 2025

Software Testing Weekly turns 5! 🥳 View on the Web Archives ISSUE 253 January 13th 2025 COMMENT Welcome to the 253rd issue! Oh my, time flies! It's hard to believe this week marks 5 years since I

CES 2025 - Sync #501

Sunday, January 12, 2025

Plus: Sam Altman reflects on the last two years; Anthropic reportedly in talks to raise $2B at $60B valuation; e-tattoo decodes brainwaves; anthrobots; top 25 biotech companies for 2025; and more! ͏ ͏

PD#608 Mistakes engineers make in large established codebases

Sunday, January 12, 2025

You can't practice it beforehand ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌

C#539 A detailed look at EF Core’s JSON Columns feature

Sunday, January 12, 2025

Comparing it with the traditional tables with indexes ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

RD#488 How to avoid issues with custom Hooks

Sunday, January 12, 2025

Using them carelessly can lead to many problems ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

Daily Coding Problem: Problem #1666 [Easy]

Sunday, January 12, 2025

Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Amazon. Given n numbers, find the greatest common denominator between them. For example,

🛜 Here's What Happens to Old Websites — Features the Pixel Should Copy From Samsung's One UI 7

Sunday, January 12, 2025

Also: What Instagram Needs to Compete With TikTok, and More! How-To Geek Logo January 12, 2025 Did You Know Mount Wingen, located near Wingen, New South Wales in Australia, is better known as Burning