SkipLabs / skip

Skip is a framework for building reactive services
https://skiplabs.io
MIT License
152 stars 10 forks source link

Add ValuesMapper and use it to simplify examples #400

Open jberdine opened 2 weeks ago

bennostein commented 2 weeks ago

Looks good to me, but I notice that all of the examples using ValuesMapper reduce the input values to a singleton output value -- I wonder if that's the more common special case here?

My (weakly-held) intuition is that one-to-one (ValueMapper) and many-to-one (i.e. as ValuesMapper is being applied here to produce a singleton) mappers should be common, but I can't think off the top of my head of many-to-many use cases which use the ValuesMapper type as defined but wouldn't just want the fully-general Mapper. WDYT?

jberdine commented 2 weeks ago

@bennostein that's a good point and I agree, I will revise. @beauby interesting, I was not thinking about possibly relying on values of other keys, as that just doesn't fit my default understanding of a map. I will try reworking the docs and maybe class names based on Benno's "one-to-one" and "many-to-one" terminology as that seems to be short and clear.