2016-08-31 11:30:51 -04:00
|
|
|
import { registerUnbound } from "discourse-common/lib/helpers";
|
2014-12-12 13:28:20 -05:00
|
|
|
|
|
|
|
registerUnbound("value-at-tl", function (data, params) {
|
2021-01-27 06:39:20 -05:00
|
|
|
let tl = parseInt(params.level, 10);
|
2014-12-12 13:28:20 -05:00
|
|
|
if (data) {
|
2021-01-27 06:39:20 -05:00
|
|
|
let item = data.find(function (d) {
|
2014-12-12 13:28:20 -05:00
|
|
|
return parseInt(d.x, 10) === tl;
|
|
|
|
});
|
|
|
|
if (item) {
|
|
|
|
return item.y;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|