Skip to content

Commit ba6062a

Browse files
committed
feat: add parsing for strings
1 parent c500c6c commit ba6062a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

lib/time.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,23 @@ const timeRepo = (algos, args, runs, id) => {
8787
* @returns {string} A locale string with type information.
8888
*/
8989
const toLocaleString = (val) => {
90+
// Parse array
9091
if (Array.isArray(val)) {
91-
return `[${val.toLocaleString()}]`
92+
if (val.length > 50) {
93+
return `[array of length ${val.length}]`
94+
} else {
95+
return `[${val.toLocaleString()}]`
96+
}
97+
}
98+
99+
// Parse string
100+
const valType = typeof val
101+
if (valType === 'string') {
102+
if (val.length > 50) {
103+
return `'string of length ${val.length}'`
104+
} else {
105+
return `'${val.toLocaleString()}'`
106+
}
92107
}
93108

94109
return val.toLocaleString()

0 commit comments

Comments
 (0)