ioredis icon indicating copy to clipboard operation
ioredis copied to clipboard

isInt function refactoring

Open 0o001 opened this issue 2 years ago • 2 comments

0o001 avatar Aug 11 '23 11:08 0o001

I wonder if "const x = parseFloat(value);" is also unnecessary.

NurimOnsemiro avatar Aug 11 '23 12:08 NurimOnsemiro

I wonder if "const x = parseFloat(value);" is also unnecessary.

I assume it's unnecessary for the following reasons:

1- Function title ... isInt(value: any): value is string ...

2- Number("1s") -> NaN parseFloat("1s") -> 1.0

Number("1n") -> NaN parseFloat("1n") -> 1.0

However, if this is an undesired situation, yes, this part can be changed; it would be more appropriate for authorized developers to answer.

https://github.com/redis/ioredis/blob/9c175502b53b400a31bd8bddc8e9a469856bc820/test/unit/utils.ts#L52

0o001 avatar Aug 11 '23 12:08 0o001