Only allow for finite samples from sampling library
This commit is contained in:
parent
5129ff20d5
commit
2ab2faf5e9
|
@ -19,7 +19,7 @@
|
|||
"subdirs": true
|
||||
}
|
||||
],
|
||||
"bsc-flags": ["-bs-super-errors", "-bs-no-version-header"],
|
||||
"bsc-flags": ["-bs-super-errors", "-bs-no-version-header", "-bs-g"],
|
||||
"package-specs": [
|
||||
{
|
||||
"module": "commonjs",
|
||||
|
|
|
@ -41,5 +41,6 @@ let run =
|
|||
(),
|
||||
)
|
||||
};
|
||||
Js.log3("IS SOME?", symbolic |> E.R.toOption |> E.O.isSome, symbolic);
|
||||
{symbolic: Some(symbolic), sampling};
|
||||
};
|
|
@ -1,25 +1,37 @@
|
|||
const _ = require("lodash");
|
||||
const { Guesstimator } = require('@foretold/guesstimator/src');
|
||||
const {
|
||||
Guesstimator
|
||||
} = require('@foretold/guesstimator/src');
|
||||
|
||||
const stringToSamples = (
|
||||
text,
|
||||
sampleCount,
|
||||
inputs = [],
|
||||
) => {
|
||||
const [_error, { parsedInput, parsedError }] = Guesstimator.parse({ text:"=" + text });
|
||||
const [_error, {
|
||||
parsedInput,
|
||||
parsedError
|
||||
}] = Guesstimator.parse({
|
||||
text: "=" + text
|
||||
});
|
||||
|
||||
const guesstimator = new Guesstimator({ parsedInput });
|
||||
const {values, errors} = guesstimator.sample(
|
||||
const guesstimator = new Guesstimator({
|
||||
parsedInput
|
||||
});
|
||||
const {
|
||||
values,
|
||||
errors
|
||||
} = guesstimator.sample(
|
||||
sampleCount,
|
||||
inputs,
|
||||
);
|
||||
if (errors.length > 0){
|
||||
if (errors.length > 0) {
|
||||
return []
|
||||
} else {
|
||||
return values
|
||||
return _.filter(values, _.isFinite)
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
stringToSamples,
|
||||
};
|
||||
};
|
Loading…
Reference in New Issue
Block a user