WIP
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
function isNumeric(n: any) {
|
||||
return !isNaN(n);
|
||||
}
|
||||
|
||||
function isBoolean(n: any) {
|
||||
if (typeof n === 'boolean') {
|
||||
return true;
|
||||
}
|
||||
n = new String(n).toLowerCase();
|
||||
if (n === 'true' || n == 'false') {
|
||||
return Boolean(n);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function convertToPossibleType(n: any) {
|
||||
if (isBoolean(n)) return Boolean('false');
|
||||
if (isNumeric(n)) return Number(n);
|
||||
return n;
|
||||
}
|
||||
Reference in New Issue
Block a user