After adding the fractional.js package, expose a helper to do the conversion and call it from the view's markup.
import fractional from 'fractional'; Template.registerHelper('fraction', function(num) { return new fractional.Fraction(num).toString(); });
That is all, check out the docs for the full API that is available.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.