mirror of
https://gitee.com/bimuziyan/ccc-obfuscated-code.git
synced 2026-05-21 07:28:54 +08:00
10 lines
249 B
JavaScript
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 !== '';
|
|
} |