Skip to content

Commit

Permalink
Clean up JS polyfills and add some TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
na-- committed Jan 15, 2021
1 parent 9f58bfd commit b504fdb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 7 additions & 9 deletions js/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ import (
// TODO: move this to a separate JS file and use go.rice to embed it
const summaryWrapperLambdaCode = `
(function() {
var forEach = function(obj, callback) {
var forEach = function (obj, callback) {
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
callback(key, obj[key]);
if (callback(key, obj[key])) {
break;
}
}
}
}
Expand Down Expand Up @@ -88,9 +90,7 @@ const summaryWrapperLambdaCode = `
return JSON.stringify(results, null, 4);
};
var oldTextSummary = function(data) {
// TODO: implement something like the current end of test summary
};
// TODO: bundle the text summary generation from jslib and get rid of oldCallback
return function(exportedSummaryCallback, jsonSummaryPath, data, oldCallback) {
var result = {};
Expand All @@ -99,12 +99,10 @@ const summaryWrapperLambdaCode = `
result = exportedSummaryCallback(data, oldCallback);
} catch (e) {
console.error('handleSummary() failed with error "' + e + '", falling back to the default summary');
//result["stdout"] = oldTextSummary(data);
result["stdout"] = oldCallback(); // TODO: delete
result["stdout"] = oldCallback(); // TODO: replace with JS function
}
} else {
// result["stdout"] = oldTextSummary(data);
result["stdout"] = oldCallback(); // TODO: delete
result["stdout"] = oldCallback(); // TODO: replace with JS function
}
// TODO: ensure we're returning a map of strings or null/undefined...
Expand Down
2 changes: 2 additions & 0 deletions stats/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,8 @@ var unitMap = map[string][]interface{}{
"us": {"µs", time.Microsecond},
}

// HumanizeValue makes the value human-readable
// TODO: get rid of this after we remove the Go-based summary
func (m *Metric) HumanizeValue(v float64, timeUnit string) string {
switch m.Type {
case Rate:
Expand Down

0 comments on commit b504fdb

Please sign in to comment.