This commit is contained in:
Cherry 2025-05-26 06:08:47 +01:00 committed by GitHub
commit f368cf2b89
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

4
src/core/Ingredient.mjs Executable file → Normal file
View file

@ -100,7 +100,7 @@ class Ingredient {
*/ */
static prepare(data, type) { static prepare(data, type) {
let number; let number;
switch (type) { switch (type) {
case "binaryString": case "binaryString":
case "binaryShortString": case "binaryShortString":
@ -116,6 +116,8 @@ class Ingredient {
} }
case "number": case "number":
if (data === null) return data; if (data === null) return data;
if (isNaN(data)) throw "Ingredient can not be empty.";
number = parseFloat(data); number = parseFloat(data);
if (isNaN(number)) { if (isNaN(number)) {
const sample = Utils.truncate(data.toString(), 10); const sample = Utils.truncate(data.toString(), 10);