Ghost/ghost/admin/helpers/gh-count-words.js

14 lines
315 B
JavaScript
Raw Normal View History

import counter from 'ghost/utils/word-count';
var countWords = Ember.Handlebars.makeBoundHelper(function (markdown) {
if (/^\s*$/.test(markdown)) {
return '0 words';
}
var count = counter(markdown || '');
return count + (count === 1 ? ' word' : ' words');
});
export default countWords;