What Are The Use Cases of Lodash Chunk method?

Chunk is a method of Lodash that splits the array into evenly sized arrays and returns them in a single array. If the array is indivisible evenly, the final chunk has the left over elements. It takes the size of the grouping in argument (the default size is 1). [Read More]

JavaScript Flatten Deeply Nested Array of Objects Into Single Level Array

Using plain JavaScript, and lodash's flatMapDeep method

Requirement: We have an array of objects that is deeply nested. We want to bring all the nested objects into the array at root level. Following is the example array familyTree that has multiple people in the root and many of them have children array containing further members: [Read More]

JavaScript Check if Key Exists in Deeply Nested Object or Array of Objects, Without Knowing the Path

Depth First Search (DFS) for key verification in an object

The following JavaScript code recursively goes through the whole object, array of objects or a collection of both to verify if the given key exists somewhere down the object. It does not require path to the key in advance. Code const keyExists = (obj, key) => { if (! [Read More]

How to Get All Uppercase Words from a String in JavaScript

And all lowercase words, too

On rare occasions, Google surprises you by returning no useful information for your search. Extracting numbers and retrieving all uppercase words from a given string in JavaScript were two such problems. In the latter case, there were all kinds of regex examples to find capitalized words or uppercase letters, but not the uppercase words. [Read More]