transitive-bullshit/random

Should the random object be callable as a shortcut for random.uniform?

transitive-bullshit opened this issue · 1 comments

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:

Closing this as I think it over-complicates things, especially with trying to be compatible between CJS and ESM.