header-case.js 334 B

123456789101112131415
  1. var noCase = require('no-case')
  2. var upperCase = require('upper-case')
  3. /**
  4. * Header case a string.
  5. *
  6. * @param {string} value
  7. * @param {string} [locale]
  8. * @return {string}
  9. */
  10. module.exports = function (value, locale) {
  11. return noCase(value, locale, '-').replace(/^.|-./g, function (m) {
  12. return upperCase(m, locale)
  13. })
  14. }