discourse/app/assets/javascripts/admin/addon/helpers/value-at-tl.js
2021-01-27 12:39:20 +01:00

16 lines
342 B
JavaScript

import { registerUnbound } from "discourse-common/lib/helpers";
registerUnbound("value-at-tl", function (data, params) {
let tl = parseInt(params.level, 10);
if (data) {
let item = data.find(function (d) {
return parseInt(d.x, 10) === tl;
});
if (item) {
return item.y;
} else {
return 0;
}
}
});