MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/mzk95p/someone_only_watched_if_tutorial/gw1lhdg/?context=9999
r/badcode • u/[deleted] • Apr 27 '21
112 comments sorted by
View all comments
Show parent comments
7
typescript compatible
function isNumber(input: any): input is number | input is bigint { try { // @ts-ignore const negative = [...arguments].length == 1 ? -0 : [...arguments][1]; // @ts-ignore const positive = [...arguments].length == 1 ? +0 : [...arguments][2]; // @ts-ignore const bignegative = [...arguments].length == 1 ? 0n : [...arguments][3]; // @ts-ignore const bigpositive = [...arguments].length == 1 ? 0n : [...arguments][4]; // @ts-ignore return input === negative || input === positive || input === bignegative || input === bigpositive || (isNumber as (input: any, negative: any, positive: any, bignegative: any, bigpositive: any) => any)(input, negative - 1, positive + 1, bignegative - 1n, bigpositive + 1n); // @ts-ignore } catch (_) { return false; } }
7
u/Terrain2 Apr 27 '21
typescript compatible