Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 490B

123456789101112131415161718192021222324252627282930
  1. /*!
  2. * toidentifier
  3. * Copyright(c) 2016 Douglas Christopher Wilson
  4. * MIT Licensed
  5. */
  6. /**
  7. * Module exports.
  8. * @public
  9. */
  10. module.exports = toIdentifier
  11. /**
  12. * Trasform the given string into a JavaScript identifier
  13. *
  14. * @param {string} str
  15. * @returns {string}
  16. * @public
  17. */
  18. function toIdentifier (str) {
  19. return str
  20. .split(' ')
  21. .map(function (token) {
  22. return token.slice(0, 1).toUpperCase() + token.slice(1)
  23. })
  24. .join('')
  25. .replace(/[^ _0-9a-z]/gi, '')
  26. }