liveBook · Manning

Address.city

As explained in Functional Programming in JavaScript

A nested property path that refers to the city field inside an address object.

address.city names the city field nested inside an address object. A path makes that location explicit, so city-based processing can be separated from the surrounding data flow. section 3.3

Focus on the city path

Define the path as ['address', 'city'], then use a Ramda lens to view that nested value while mapping over people. The extracted cities can be reduced into counts or grouped with groupBy. section 3.3

const countryPath = ['address','city'];
const countryLens = R.lens(R.path(cityPath), R.assocPath(cityPath));

Shows the path-array form used to focus on address.city with a Ramda lens. section 3.3

How Functional Programming in JavaScript covers it

How deep it goes
Defines the nested path and demonstrates lens-based access, but stops short of explaining lens internals.
Examples
Uses a people array, address records, a path array, city extraction, counting, and grouping.
What you can do after
Apply it via Ramda to focus on nested city values during functional collection processing.
How it connects
Connects nested objects with lenses, map, reduce, and groupBy.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Functional Programming in JavaScript. The section links point to the parts of the book it draws on.