Files
SerpentRace/SerpentRace_Backend/node_modules/validator/es/lib/toBoolean.js
T
2025-07-18 09:20:40 +02:00

8 lines
247 B
JavaScript

import assertString from './util/assertString';
export default function toBoolean(str, strict) {
assertString(str);
if (strict) {
return str === '1' || /^true$/i.test(str);
}
return str !== '0' && !/^false$/i.test(str) && str !== '';
}