Writing fluent functional code
Ben
1631

Looks nice!

I think the second example (with spread/rest) is more idiomatic js.
It’ll be maybe nicer with default value for the “value” arg so:
```function SiteBuilder(value={})```
no empty object is needed when creating a new SiteBuilder.

I think the real magic in JS is that you can create such builder dynamically for any data types with something like createBuilder(fieldList) that create all the “with” functions. ([`with${propName`] )

Although I doubt TS type system is powerful enough to support something like createBuilder<TFields, TBuilder>(fields:TFields):TBuilder.
Still, it’s feel like creating Java api for JS objects, I’m not sure “builder” semantics are needed in JS.

I hope that in the future will have pipe operator (https://github.com/gilbert/es-pipeline-operator) and then everything will be able to feel fluent without hacking objects/functions :)

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.