mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
fix: restore non-negative count normalizer
This commit is contained in:
@@ -101,6 +101,14 @@ function normalizeTimestamp(value, fallbackValue = Date.now()) {
|
||||
return Math.floor(Number(fallbackValue) || Date.now());
|
||||
}
|
||||
|
||||
function normalizeNonNegativeInteger(value, fallback = 0) {
|
||||
const parsed = Number(value);
|
||||
if (!Number.isFinite(parsed)) {
|
||||
return Math.max(0, Math.floor(Number(fallback) || 0));
|
||||
}
|
||||
return Math.max(0, Math.floor(parsed));
|
||||
}
|
||||
|
||||
function toPlainData(value, fallbackValue = null) {
|
||||
if (value == null) {
|
||||
return fallbackValue;
|
||||
|
||||
Reference in New Issue
Block a user