A polymorphic function manipulates structured data through accessible keys, paths, or collection shapes instead of depending on a specific domain class. Records represented as heterogeneous string maps can therefore share operations such as retrieving, filtering, merging, renaming, and serializing fields. This flexibility weakens code–data dependencies, though it gives up compile-time field safety. section 3.0 section 3.6
A polymorphic function typically works by:
- Receiving a map, array, information path, or field name rather than a domain-specific object. section 3.3
- Applying the same operation across different records, collections, or database results. section 10.5
- Composing small operations to express business logic and web-service data flows. section 11.8
- Moving complex manipulation details into reusable custom functions when library operations are insufficient. section 14.0
Joining records from two sources
A generic joinArrays function accepts two arrays and two key names, indexes each array with keyBy, merges the resulting maps, and returns their values. The same function can combine database records with external-service records without knowing a Book class. section 11.6
Updating nested data
An update function accepts a map, path, and transformation function: it retrieves the current value, transforms it, and writes the result back. Thus removing duplicate authors becomes update(book, "authors", _.uniq). section 14.1
Lodash functions introduced in this chapter
Browse the generic collection and map operations used for paths, presence checks, merging, mapping, filtering, and value extraction. section 3.6



















