Earlier quoted context omitted.
Religiously splitting functions with boolean arguments doesn't always result in more maintainable code. Instead of trigonometry functions, how would you refactor JS's fetch() with many of its behaviour-altering flags?
> how would you refactor JS's fetch() as @flavius29663 said ( https://news.ycombinator.com/item?id=28593669 ) you can use the builder pattern FetchBuilder() .withUrl(ur) .withMode("cors") .withCache(true) .withHeader('Content-Type', 'application/json') .accept('*/*') .post() .then(response => response.json()) .then(data => console.log(data));
// The original "misses the point"
trig(mode="cos", type="hyperbolic")
// The style fetch() uses today
trig({mode: "cos", type: "hyperbolic"})
// The builder refactor
trigBuilder().withMode("Cos").withType("hyperbolic").calculate()