Skip to content

xet( map, key, factory ) - if map has own property key, return its value. If not, execute factory, assign the return value to key, then return it.

License

Notifications You must be signed in to change notification settings

barneycarroll/xet

Repository files navigation

Build Status

xet ([ʃɛt]) retrieves a map's value for a given key, setting it with a provided factory if it isn't present.

xet( map, key, factory )
// where
const factory = (key, value) => value

This is useful when writing in a point-free declarative dialect - virtual DOM view templates for example - and want to write functions that can conditionally run setup in the form of the factory.

About

xet( map, key, factory ) - if map has own property key, return its value. If not, execute factory, assign the return value to key, then return it.

Resources

License

Stars

Watchers

Forks

Packages

No packages published