-
Notifications
You must be signed in to change notification settings - Fork 31
Closed
Description
This is using version 1.0.76 installed from npm today.
When getting a single sample from the normal distribution, an error is thrown:
const libR = require('lib-r-math.js');
libR.Normal().rnorm();
TypeError: r_func_1.seq(...)(...)(...).map is not a function
at Object.rnorm (./node_modules/lib-r-math.js/dist/lib/libR.js:3905:41)
at Object.rnorm (./node_modules/lib-r-math.js/dist/lib/libR.js:7503:54)
at repl:1:15
at ContextifyScript.Script.runInThisContext (vm.js:44:33)
at REPLServer.defaultEval (repl.js:239:29)
at bound (domain.js:301:14)
at REPLServer.runBound [as eval] (domain.js:314:12)
at REPLServer.onLine (repl.js:440:10)
at emitOne (events.js:120:20)
at REPLServer.emit (events.js:210:7)
In contrast, libR.Normal().rnorm(2)
works.
Would you consider changing the functions to always return number[]
instead of number | number[]
? The fact that the return type isn't known ahead of time will require a lot of extra coding and surely lead to a lot more run-time errors. More convenient yet would be to have two functions: one that returns number
and one that returns number[]
.
jacobbogers
Metadata
Metadata
Assignees
Labels
No labels