mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-30 17:10:42 +03:00
feat: prevent non-integer bases
Signed-off-by: Corentin Thomasset <corentin.thomasset74@gmail.com>
This commit is contained in:
1 parent
0bf13326c8
commit
45112d1b33
2 files changed
+23
-7
No files matched your search
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user