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

Microsoft's and Google's bet on AI is paying off - Weekly News Roundup - Issue #464

Friday, April 26, 2024

Plus: AI-controlled F-16 has been dogfighting with humans; Grok-1.5 Vision; BionicBee; Microsoft's AI generates realistic deepfakes from a single photo; and more! ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

🤓 The Meta Quest Might Be the VR Steam Deck Soon — Games to Play After Finishing Wordle

Friday, April 26, 2024

Also: Why a Cheap Soundbar Is Better Than Nothing, and More! How-To Geek Logo April 26, 2024 Did You Know TMI: Rhinotillexomania is the medical term for obsessive nose picking. 🖥️ Get Those Updates

JSK Daily for Apr 26, 2024

Friday, April 26, 2024

JSK Daily for Apr 26, 2024 View this email in your browser A community curated daily e-mail of JavaScript news A Solid primer on Signals with Ryan Carniato (JS Party #320) Ryan Carniato joins Amal

So are we banning TikTok or what?

Friday, April 26, 2024

Also: Can an influencer really tank an $800M company? View this email online in your browser By Haje Jan Kamps Friday, April 26, 2024 Image Credits: Jonathan Raa/NurPhoto / Getty Images Welcome to

[AI Incubator] 300+ people are already in. Enrollment closes tonight at 11:59pm PT.

Friday, April 26, 2024

How to decide if you're ready. ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

Daily Coding Problem: Problem #1423 [Medium]

Friday, April 26, 2024

Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Google. You are given an array of nonnegative integers. Let's say you start at the

Data science for Product Managers

Friday, April 26, 2024

Crucial resources to empower you with data that matters. ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

Inner Thoughts

Friday, April 26, 2024

'The Inner Circle' Comes Around... Inner Thoughts By MG Siegler • 26 Apr 2024 View in browser View in browser If you'll allow me a brief meta blurb this week (not a Meta blurb, plenty of

Digest #135: Kubernetes Hacks, Terraform CI/CD, HashiCorp Acquisition, AWS Data Transfer Monitoring

Friday, April 26, 2024

Explore Advanced Kubernetes Techniques, Dive Into Terraform CI/CD Frameworks, Monitor AWS Data Transfer, and Explore Cloud Security with Gitleaks! ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

Build5Nines Newsletter - April 25, 2024

Friday, April 26, 2024

View this email in your browser Build5Nines Build5Nines Newsletter Thank you for subscribing! I look forward to sharing with you the latest cloud news, technical help, and other thoughts around DevOps