This project was inspired by awesome template tags and filters shipped with Django.
Installation:
meteor add msamoylov:missing-helpers
{{stripTags yourStringWithHTML}}
. This global template helper removes HTML tags from your string. It's possible to provide a second parameter with the list of allowed tags. For instance,{{stripTags yourStringWithHTML "<strong><p>"}}
{{hasVerifiedEmail userObject}}
. Can be useful for prompting users to verify their email addresses. If the parameter is omitted, the helper uses ```{{currentUser}}`` variable.{{currentYear}}
returns a string with the current year. Can be useful for generating a footer with your copyright.{{formatDateTime createdAt formatString}}
returns a formatted date according to moment.js formatting rules. For instance,{{formatDateTime createdAt "MMM D"}}
produces "Jan 13", and{{formatDateTime createdAt}}
does "2015-01-13T23:44:50+02:00"{{timeSince createdAt}}
returns relative time since a given date. A wrapper for moment().fromNow(){{truncateChars yourString length}}
truncates a string after a certain number of characters.{{linebreaksbr yourText}}
converts all newlines in a piece of plain text to HTML line breaks (<br>
). If you provide a second parameter astrue
, it will remove the existing newlines from text.
MissingUtility.cleanTags(yourStringWithHTML)
removes all HTML tags from a given string. The second parameter accepts a string with allowed tags. For instance,MissingUtility.cleanTags(yourStringWithHTML, '<strong><p>')
.MissingUtility.hasVerifiedEmail(userObject)
determines if a user has verified his email address.MissingUtility.truncateChars(yourString, length)
truncates a string after a certain number of characters.MissingUtility.nl2br(yourText)
converts all newlines in a piece of plain text to HTML line breaks (<br>
). If you provide a second parameter astrue
, it will remove the existing newlines from text.