export default function toBoolean(input: any): boolean | undefined {
  if (typeof input !== "number" && typeof input !== "string" && typeof input !== "boolean") {
    return undefined;
  }

  if (typeof input === "boolean") return input;
  if (typeof input === "number") return input ? false : true;
  if (typeof input === "string")
    return input.toLowerCase() === "on" ? true : input.toLowerCase() === "off" ? false : undefined;

  return undefined;
}
