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

16 lines
340 B
Plaintext
Raw Normal View History

2018-06-15 23:03:24 +08:00
import { registerUnbound } from "discourse-common/lib/helpers";
2014-12-13 02:28:20 +08:00
2018-06-15 23:03:24 +08:00
registerUnbound("value-at-tl", function(data, params) {
2014-12-13 02:28:20 +08:00
var tl = parseInt(params.level, 10);
if (data) {
2018-06-15 23:03:24 +08:00
var item = data.find(function(d) {
return parseInt(d.x, 10) === tl;
});
2014-12-13 02:28:20 +08:00
if (item) {
return item.y;
} else {
return 0;
}
}
});