ohif-viewer/Packages/ohif-core/client/helpers/number.js

18 lines
454 B
JavaScript
Raw Normal View History

import { _ } from 'meteor/underscore';
import { Template } from 'meteor/templating';
/**
* Global Blaze UI helpers to work with numeric operations
*/
// Sum all the given numbers
Template.registerHelper('sum', (...values) => {
let result = 0;
_.each(_.initial(values, 1), value => (result += (value | 0)));
return result;
});
2017-01-23 16:00:44 +01:00
Template.registerHelper('isValidNumber', value => {
return typeof value === 'number' && !isNaN(value);
});