while this /could/ (not benched marked in any way) be slower it
operates on so small data sets that this isn't worth it having double
the code lines.
A map + join is still quite readable and not yet "code golfy"
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
return gettext("None");
}
- let retval = "";
- let first = true;
let parsed = PVE.Parser.parsePropertyString(value);
-
- Ext.Object.each(parsed, (k, v) => {
- if (!first) {
- retval += ", ";
- }
- // v is in KiB/s
- retval += k + ": " + Proxmox.Utils.format_size(v * 1024) + "/s";
- first = false;
- });
-
- return retval;
+ return Object.entries(parsed)
+ .map(([k, v]) => k + ": " + Proxmox.Utils.format_size(v * 1024) + "/s")
+ .join(',');
},
initComponent : function() {