intern-Assignment/Sequelize-library/node_modules/validator/es/lib/toBoolean.js

8 lines
247 B
JavaScript
Raw Normal View History

2025-01-31 09:50:39 +00:00
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 !== '';
}