feat: prevent non-integer bases

Signed-off-by: Corentin Thomasset <corentin.thomasset74@gmail.com>
This commit is contained in:
Corentin Thomasset authored and Corentin THOMASSET committed 2020-06-07 19:20:00 +02:00
1 parent 0bf13326c8
commit 45112d1b33
2 files changed
+23 -7

No files matched your search

+6 -1
View File
@@ -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
}