API/api.medcify.app/node_modules/validator/es/lib/toBoolean.js
2022-09-26 11:41:44 +05:30

10 lines
249 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 !== '';
}