MultiLoader-Template/node_modules/es-toolkit/dist/compat/math/add.mjs
3944Realms 768f38fc97 feat: 可使用的构建模板
修改了脚本,使其可以推给Maven仓库
2026-05-03 13:02:19 +08:00

23 lines
563 B
JavaScript

import { toNumber } from '../util/toNumber.mjs';
import { toString } from '../util/toString.mjs';
function add(value, other) {
if (value === undefined && other === undefined) {
return 0;
}
if (value === undefined || other === undefined) {
return value ?? other;
}
if (typeof value === 'string' || typeof other === 'string') {
value = toString(value);
other = toString(other);
}
else {
value = toNumber(value);
other = toNumber(other);
}
return value + other;
}
export { add };