liveBook · Manning

Prop

As explained in The Joy of JavaScript

A book-local helper function that returns a property value from an object by property name, often in curried form.

Defines a curried helper that binds a property name first, then extracts that property from an object. If the value is a function, it calls the function with the object as its receiver. section 4.4.1

Bind once, reuse across objects

const getFunds = prop('funds'); getFunds(transaction); // 10.0 [tx1, tx2, tx3].map(prop('funds')); // [10.0, 12.5, 20.0]

How The Joy of JavaScript covers it

How deep it goes
Explains manual currying, method invocation, multiple-property extraction, and mapping over transactions.
Examples
Uses transaction objects, funds accessors, multi-property extraction, and mapped property or method access.
What you can do after
Apply it via JavaScript functions and map to build reusable accessors for individual objects or collections.
How it connects
Connects currying, higher-order functions, map, composition, and method invocation.

Related concepts

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