utility-function-extractor/packages/webpage-legacy/lib/squiggleWrapper.js

24 lines
592 B
JavaScript
Raw Normal View History

import axios from "axios";
export async function squiggleWrapper(input) {
let response = await axios.post("https://server.loki.red/squiggle", {
model: `mean(${input})`,
});
if (response.status == 200) {
try {
console.log(response.data);
if (!!response.data && !!response.data.value) {
// console.log(response.data.value);
2022-06-15 04:46:25 +00:00
let result = response.data.value.value; //hd.VAL;
console.log(result);
return result;
}
} catch (error) {
console.log(error);
return null;
}
}
return null;
}
// squiggle("1 to 4");