You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

20 lines
421 B

/**
* Get boolean customisation value from attribute
*/
function toBoolean(name, value, defaultValue) {
switch (typeof value) {
case "boolean": return value;
case "number": return !!value;
case "string": switch (value.toLowerCase()) {
case "1":
case "true":
case name.toLowerCase(): return true;
case "0":
case "false":
case "": return false;
}
}
return defaultValue;
}
export { toBoolean };