@knime/utils
Advanced tools
+6
-0
| # @knime/utils | ||
| ## 1.10.0 | ||
| ### Minor Changes | ||
| - ea3b7e1: Add util to format file-sizes | ||
| ## 1.9.2 | ||
@@ -4,0 +10,0 @@ |
+3
-2
| { | ||
| "name": "@knime/utils", | ||
| "version": "1.9.2", | ||
| "version": "1.10.0", | ||
| "description": "Internal utility functions and constants shared across @knime packages.", | ||
@@ -17,3 +17,4 @@ "repository": { | ||
| "date-fns-tz": "2.0.0", | ||
| "dompurify": "^3.2.7" | ||
| "dompurify": "^3.2.7", | ||
| "filesize": "10.0.6" | ||
| }, | ||
@@ -20,0 +21,0 @@ "peerDependencies": { |
+16
-0
@@ -0,1 +1,3 @@ | ||
| import { filesize } from "filesize"; | ||
| import getLocalTimeZone from "./localTimezone"; | ||
@@ -98,1 +100,15 @@ /** | ||
| showTime ? formatDateTimeString(date, true) : formatDateString(date, true); | ||
| export const formatFileSize = (bytes: number, decimals = 1): string => { | ||
| const safeBytes = Number.isFinite(bytes) && bytes >= 0 ? bytes : 0; | ||
| const safeDecimals = | ||
| Number.isFinite(decimals) && decimals >= 0 ? Math.floor(decimals) : 0; | ||
| return filesize(safeBytes, { | ||
| output: "string", | ||
| base: 2, | ||
| standard: "iec", | ||
| round: safeDecimals, | ||
| pad: true, | ||
| }) as string; | ||
| }; |
+2
-0
@@ -8,2 +8,3 @@ import { capitalize, caseFormatter } from "./capitalize"; | ||
| formatDateTimeString, | ||
| formatFileSize, | ||
| formatLocalDateTimeString, | ||
@@ -59,2 +60,3 @@ formatTimeString, | ||
| formatDateTimeString, | ||
| formatFileSize, | ||
| getDeepActiveElement, | ||
@@ -61,0 +63,0 @@ formatLocalDateTimeString, |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Unidentified License
LicenseSomething that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Unidentified License
LicenseSomething that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
98501
0.57%1619
0.94%5
25%+ Added
+ Added