Initial commit
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
const boolean = function (value: any): boolean {
|
||||
switch (Object.prototype.toString.call(value)) {
|
||||
case '[object String]':
|
||||
return [ 'true', 't', 'yes', 'y', 'on', '1' ].includes(value.trim().toLowerCase());
|
||||
|
||||
case '[object Number]':
|
||||
return value.valueOf() === 1;
|
||||
|
||||
case '[object Boolean]':
|
||||
return value.valueOf();
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
export { boolean };
|
||||
Reference in New Issue
Block a user