1.1.3 • Published 3 years ago

@zachvictor/gu-map v1.1.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

GuMap — 固Map

is strong, solid, and sure—an allusion to this class’s immutability-features.

What is GuMap? What does it do? \ GuMap is a JavaScript class that extends the Map prototype to support dot accessor notation and immutability features. Unlike Map, GuMap can be configured to throw errors on state mutation.

What value does GuMap add? \ Dot accessor notation is idiomatic and concise. Immutability can protect against unwanted state mutation. A Map that supports immutable properties may be able to serve compositional strategies that draw on functional programming patterns. Throwing an error on state mutation can help pinpoint logical errors quickly and prevent a mutated variable from "metastasizing" into a bigger problem.

How is GuMap implemented? \ The GuMap class extends Map. Its constructor returns a Proxy, which is used to implement immutability, dot accessor notation for get and set, and "bridges" to standard Map properties. The GuMap class does not bridge Map[@@iterator]. Please use entries() instead.

What is the GuMapConfig class for? \ The GuMapConfig class structures the parameter object of the GuMap constructor. It helps humans and machines "understand" the parameterization, the one for practical purposes, the other (typically) for static code analysis.

What’s in a name? \ The name “GuMap” is a bilingual compound word, transliterating 固Map (gù-map) into Latin letters.