singleton
Example
const rand = singleton(Math.random);
const first = rand.getInstance();
const second = rand.getInstance(); // first === second
Changing the inner instance
const str = singleton(() => "a");
const first = rand.getInstance(); // "a"
str.setInstance("b");
const second = rand.getInstance(); // "b", first !== second