@data-fair/lib-vue 1.19.0 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/format/bytes.js +5 -1
  2. package/package.json +1 -1
package/format/bytes.js CHANGED
@@ -8,7 +8,11 @@ export function formatBytes (bytes, locale = 'fr') {
8
8
  for (let i = 0; i < def.length; i++) {
9
9
  const step = def[i][0]
10
10
  if (bytesInt < step || i === def.length - 1) {
11
- return (bytesInt / (def[i - 1][0] || 1)).toLocaleString(locale, { maximumFractionDigits: 0 }) + ' ' + def[i - 1][1]
11
+ const value = bytesInt / (def[i - 1][0] || 1)
12
+ let digits = 2
13
+ if (value > 1) { digits = 1 }
14
+ if (value > 10) { digits = 0 }
15
+ return value.toLocaleString(locale, { maximumFractionDigits: digits }) + ' ' + def[i - 1][1]
12
16
  }
13
17
  }
14
18
  return '' // this is only for strict typing, but the code cannot go there, the return in the loop is always called
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/lib-vue",
3
- "version": "1.19.0",
3
+ "version": "1.20.0",
4
4
  "description": "Composables and other utilities for Vue applications in the data-fair stack.",
5
5
  "main": "index.js",
6
6
  "files": [