A workshop about JavaScript iteration protocols: iterator, iterable, async iterator, async iterable

Overview

JavaScript Iteration protocol workshop

Node.js CI

A workshop about JavaScript iteration protocols: iterator, iterable, async iterator, async iterable by @loige. 😎

I also have a workshop about Node.js Streams.

Prerequisites

Before getting started, make sure you have the following installed:

  • Node.js 16+
  • NPM 8+
  • A text editor of your choice
  • A bash-compatible shell

Getting started

Clone the repository and run npm install to get all the necessary dependencies.

The workshop is divided in chapters and the first chapter starts at 01-intro.

Every chapter will teach you a specific iteration concept and offer you some examples and exercises to familiarize with that concept.

You will often find 2 different types of interactive actions:

  • 🎭 PLAY : commands or instructions you should spend some time with to get familiar with some concepts or APIs

  • 🏹 Exercise: when you have to use some of the concepts you just learned to solve a programming problem. Generally every exercise will have a test that you can run to validate your solution.

Enjoy! 🙃

➡️ GET STARTED.

Shameless plug 😇

If you like this piece of work, consider supporting me by getting a copy of Node.js Design Patterns, Third Edition, which also goes into great depth about generators, iterator protocols, streams and related design patterns.

If you already have this book, please consider writing a review on Amazon, Packt, GoodReads or in any other review channel that you generally use. That would support us greatly 🙏 .

Contributing

In the spirit of Open Source, everyone is very welcome to contribute to this project. You can contribute just by submitting bugs or suggesting improvements by opening an issue on GitHub or by submitting a PR.

License

Licensed under MIT License. © Luciano Mammino.

You might also like...

GatsbyConf - Decoupling Drupal Using Gatsby: A Crash Course workshop

GatsbyConf - Decoupling Drupal Using Gatsby: A Crash Course workshop

Sep 29, 2022

Workshop contruyendo una API Rest con Node.js + Koa.js

Workshop contruyendo una API Rest con Node.js + Koa.js

Workshop contruyendo una API Rest con Node.js + Koa.js Tabla de Contenido Acerca de Introducción Explicación del caso de uso Ciclo de vida de las soli

Apr 8, 2022

For this workshop, we're going to learn more about cloud computing by exploring how to use Pulumi to build, configure, and deploy a real-life, modern application using Docker

For this workshop, we're going to learn more about cloud computing by exploring how to use Pulumi to build, configure, and deploy a real-life, modern application using Docker. We will create a frontend, a backend, and a database to deploy the Pulumipus Boba Tea Shop. Along the way, we'll learn more about how Pulumi works.

Dec 29, 2022

Resources for the App.js Conf Workshop 2022 hosted by Evan Bacon and Lydia Hallie

App.js Conf 2021 React Native workshop Order of sections: up-and-going: Learn about React Native and options to start your first project. get-started:

Sep 14, 2022

Here are the sources for the wdi5 workshop at UI5con 2022.

wdi5 workshop at UI5con 2022 Here are the sources for the wdi5 workshop at UI5con 2022. prerequisites please have this installed on your 'puter: Node

Oct 19, 2022

REST API for a rudimentary blog - from Prisma Day 22 NestJS workshop

NestJS Workshop Prisma Day 22 - Let's build a REST API with NestJS and Prisma! Welcome to the code repository for the Prisma Day 2022 NestJS Workshop!

Jan 3, 2023

Remix enables you to build fantastic user experiences for the web and feel happy with the code that got you there. In this workshop, we'll look at some more advanced use cases when building Remix applications.

💿 Advanced Remix Workshop Remix enables you to build fantastic user experiences for the web and feel happy with the code that got you there. In this

Dec 9, 2022

Remix enables you to build fantastic user experiences for the web and feel happy with the code that got you there. Get a jumpstart on Remix with this workshop.

💿 Remix Fundamentals Build Better websites with Remix Remix enables you to build fantastic user experiences for the web and feel happy with the code

Dec 25, 2022

Workshop for starknetCC (nextjs x starknetjs x cairo)

Workshop for starknetCC (nextjs x starknetjs x cairo)

NextJS - Starknet.js - Cairo • Workshop StarknetCC - Full dApp workshop by Alpha Road team You'll find the PDF presentation here Introduction This wor

Nov 8, 2022
Comments
  • another approach to consider

    another approach to consider

    This is the exact same solution as the 05-async-iterator-protocol solution, with just one line inserted:

    [Symbol.asyncIterator]() { return this; },
    

    That line makes the iterator an iterable of itself, which is generally a good best practice for iterators anyway.

    Here it simplifies this instead of having to create an additional layer of nesting.

    Note: you already did this same trick for the synchronous iterator / iterable solution pairing.

    opened by getify 1
Owner
Luciano Mammino
FullStack ☁️ developer, entrepreneur, fighter, butterfly maker! 📗 Co-author https://nodejsdp.link 💌 maintainer https://fstack.link
Luciano Mammino
A small (~600B gzip), useful set of methods for lazy iteration of iterables.

@ricokahler/lazy · A small (~600B gzip*), useful set of methods for lazy iteration of iterables. Why this lazy lib? Do I even need a lazy lib? Install

Rico Kahler 11 Sep 10, 2022
In this repository, I try to perform a mainnet fork and then simulate popular smart contract exploits on various DEFI Protocols using Hardhat Framework.

defiHacks_via_Hardhat 1. Alchemix Access Control Bug Any user could have called setWhitelist() to give an attacker the ability to call the harvest fun

null 34 Dec 27, 2022
Groth16 proofs are very popular and are used by many protocols in production.

Geometry presents: the Groth16 Malleability Challenge Preamble Groth16 proofs are very popular and are used by many protocols in production. Libraries

Geometry 39 Dec 14, 2022
This Next.js app is designed to be used with the Figment Learn Pathways, to help developers learn about various blockchain protocols such as Solana, NEAR, Secret, Polygon and Polkadot!

???? What is learn-web3-dapp? We made this decentralized application (dApp) to help developers learn about Web 3 protocols. It's a Next.js app that us

t0nto 8 Oct 1, 2022
Typesafe API for processing iterable data in TypeScript and JavaScript.

Stream API Type-safe API for processing iterable data in TypeScript and JavaScript similarly to Java 8 Stream API, LINQ or Kotlin Sequences. Unlike Rx

Norbert Szilagyi 31 Aug 4, 2022
An iterator wrapper that supports Rust-style chaining

Riter (in development) An iterator wrapper that supports Rust-style chaining Install TODO: This package is not yet available. Once it's mature enough,

잇창명 3 Mar 3, 2022
Utility functions for iterators. Inspired by Rust's `std::iter::Iterator` trait.

iter-funcs About Utility functions for iterators. Inspired by Rust's std::iter::Iterator trait. This library uses JavaScript native iterators, so it's

Shuntaro Nishizawa 6 Dec 27, 2022
Portuguese version of the Cassandra driver javascript node.js workshop

Versão em Português do workshop Cassandra driver javascript node.js Olá e bem-vindo! Este é o repositório complementar para a apresentação prática dos

DataStax Developers 2 Mar 17, 2022
ITkonekt .NET workshop

Autobarn This is the sample application for Dylan Beattie's workshop on distributed systems with .NET. It's an Asp.NET Core web application based on v

Ursatile 1 Dec 19, 2021
Repository for hands on practice in Git and GitHub workshop

Git and Github Workshop Jan 2022 Successful contributors ✨ of this project will be featured on the GDSC website so as to bring attraction and learn vi

IIIT Vadodara Open Source 2 Feb 10, 2022