Return a small object that groups behavior with captured settings.

Factory Namespace

factory_namespace.js
const step = 2;
function makeCounter(increment) {
  return {
    next(value) {
      return value + increment;
    },
  };
}

const nextValue = makeCounter(step).next(10);

console.log("step=" + step);
console.log("next=" + nextValue);
factory-namespace A factory can build a tiny namespace with methods that share settings. The returned object is used immediately here so replay stays focused on scalar results.