8 lines
		
	
	
		
			247 B
		
	
	
	
		
			JavaScript
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			8 lines
		
	
	
		
			247 B
		
	
	
	
		
			JavaScript
		
	
	
		
			Executable File
		
	
	
	
	
| 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 !== '';
 | |
| } |