Should the random object be callable as a shortcut for random.uniform?
transitive-bullshit opened this issue · 1 comments
transitive-bullshit commented
Currently, you have to do this:
const random = require('random')
random.uniform() // [ 0, 1 )
But it would be nice to also support this syntax:
const random = require('random')
random() // [ 0, 1 )
This is possible, however, the implementation is pretty hacky and uses Object.setPrototypeOf which MDN explicitly warns against using for performance reasons.
References:
transitive-bullshit commented
Closing this as I think it over-complicates things, especially with trying to be compatible between CJS and ESM.