discourse/app/assets/javascripts/admin/addon/helpers/value-at-tl.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
386 B
JavaScript
Raw Normal View History

import { registerRawHelper } from "discourse-common/lib/helpers";
2014-12-13 02:28:20 +08:00
registerRawHelper("value-at-tl", valueAtTl);
export default function valueAtTl(data, params = {}) {
2021-01-27 19:39:20 +08:00
let tl = parseInt(params.level, 10);
2014-12-13 02:28:20 +08:00
if (data) {
2021-01-27 19:39:20 +08:00
let item = data.find(function (d) {
2014-12-13 02:28:20 +08:00
return parseInt(d.x, 10) === tl;
});
if (item) {
return item.y;
} else {
return 0;
}
}
}