ckknight / random-js

A mathematically correct random number generator library for JavaScript.
MIT License
603 stars 49 forks source link

cannot be imported properly in jest backend #26

Closed yiakwy closed 5 years ago

yiakwy commented 6 years ago

(1) When used with es6 "import" keyword, I tested a working solution

import * as Random from "random-js"

let engine = Random.engines.mt19937().autoSeed()
let dist = new Random.default(engine)

(2) However, if I work it in jest (Facebook unit test framework for es6)

both the above codes and following codes do not work

var Random = require("random-js")

let engine = Random.engines.mt19937()
let dist = new Random(engine)

The constructor developed here is strange for me.

ckknight commented 5 years ago

I believe this problem is allayed with v2.0.0-rc1. I will close this issue once v2.0.0 is officially released.

yiakwy commented 5 years ago

Sure. I am glad to see we have resolved the import problem for es6.