blog/themes/chameleon/scripts/titleCase.js

14 lines
312 B
JavaScript

'use strict'
/* global hexo */
/*
* Simpler version of titlecase() https://github.com/rvagg/titlecase
* Does not ignore words with a dot
*/
hexo.extend.helper.register('titleCase', (str) => {
return str.replace(/[\w]+[^\s-]*/g, (match) => {
return match.charAt(0).toUpperCase() + match.substr(1)
})
})