LoigeLoige

#design-patterns

3 posts in this collection

JavaScript iterator patterns

In this article we will explore different ways to create iterators and iterable values in Javascript, specifically functions, iterators, iterables and generators. JavaScript is a very flexible language and most often you can achieve the same goals in many different ways, iterators are no exception! Wikipedia defines iterators as follows: In computer programming, an iterator is an object that enables a programmer to traverse a container, particularly lists. Various types of iterators are often provided via a…

Luciano Mammino's Profile pictureLuciano Mammino#javascript, #node-js, #design-patterns21 January, 201912 min

Read the post →

Emerging JavaScript pattern: multiple return values

In this article, I want to explore an interesting pattern that I am seeing more and more in JavaScript code which allows you to return multiple values from a function. You probably know already that JavaScript does not support multiple return values natively, so this article will actually explore some ways to “simulate” this behavior. One of the most famous usages of this pattern I have seen recently is within React Hooks, but before delving into that, let’s see what I mean with “multiple return values” by…

Announcing the book "Node.js design patterns - second edition"

In this post I am going to introduce my last side-project: “Node.js design patterns — second edition”, a technical book about Node.js and design patterns published by Packt. This blog has been a very quite place in the last 8-9 months, this is because almost all my free time has been absorbed by one of my most ambitious side projects: co-writing a book about Node.js and design patterns! I am finally happy to announce that “Node.js design patterns — second edition” has been published. You can keep reading…