Skip to content

Commit b1b7b12

Browse files
committed
Remove redundant utility function twoDigits
1 parent 050b31f commit b1b7b12

3 files changed

Lines changed: 1 addition & 17 deletions

File tree

src/components/sunburst/sunburst-container-utils.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { twoDigits } from '../../js/utils';
2-
31
export function getSize () {
42
const w = window.innerWidth || document.documentElement.clientWidth ||
53
document.body.clientWidth;
@@ -38,7 +36,7 @@ export function decodeCompressedJson (json) {
3836
for (let y = 1; y < json.captures[0][i][j].length; y++) {
3937
const [time, simhashIndex] = json.captures[0][i][j][y];
4038
const simhash = json.hashes[simhashIndex];
41-
const timestamp = `${year}${twoDigits(month)}${twoDigits(day)}${time}`;
39+
const timestamp = `${year}${String(month).padStart(2, '0')}${String(day).padStart(2, '0')}${time}`;
4240
newJson.push([timestamp, simhash]);
4341
}
4442
}

src/js/__tests__/utils.test.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/js/utils.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,6 @@ export function fetchWithTimeout (url, params) {
110110
});
111111
}
112112

113-
export function twoDigits (n) {
114-
if (typeof n === 'string') {
115-
return n;
116-
}
117-
return n > 9 ? '' + n : '0' + n;
118-
}
119-
120113
export function getKeyByValue (obj, value) {
121114
return Object.keys(obj).find(key => obj[key] === value);
122115
}

0 commit comments

Comments
 (0)