ssbc / ssb-config

standard configuration for ssb
MIT License
23 stars 18 forks source link

Why does this module exist? #74

Open christianbundy opened 4 years ago

christianbundy commented 4 years ago

This feels like a very silly question, but why don't each of these module just encode their own defaults? The more time I spend thinking about this pattern, the more of an antipattern it feels like.

Current implementtion

const ssbConfig = () => ({
  foo: 42
});

const ssbFoo = (config) => {
  console.log(config.foo);
};

ssbFoo(ssbConfig());

"Proposal"

const ssbFoo = (config) => {
  if (config.foo === undefined) {
    config.foo = 42;
  }
  console.log(config.foo);
}

ssbFoo();
stale[bot] commented 4 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?