mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-27 01:56:15 -04:00
feat: prevent non-integer bases
Signed-off-by: Corentin Thomasset <corentin.thomasset74@gmail.com>
This commit is contained in:
parent
0bf13326c8
commit
45112d1b33
2 changed files with 23 additions and 7 deletions
|
@ -24,8 +24,13 @@ const formatBytes = (bytes, decimals = 2) => {
|
|||
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
||||
}
|
||||
|
||||
const isInt = (value) => {
|
||||
return !isNaN(value) && ((x) => (x | 0) === x)(parseFloat(value))
|
||||
}
|
||||
|
||||
export {
|
||||
copyToClipboard,
|
||||
fileIsImage,
|
||||
formatBytes
|
||||
formatBytes,
|
||||
isInt
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue