Açıklama Yok

index.js 550B

123456789101112131415161718192021222324252627
  1. 'use strict';
  2. module.exports = function () {
  3. var str = [].map.call(arguments, function (str) {
  4. return str.trim();
  5. }).filter(function (str) {
  6. return str.length;
  7. }).join('-');
  8. if (!str.length) {
  9. return '';
  10. }
  11. if (str.length === 1 || !(/[_.\- ]+/).test(str) ) {
  12. if (str[0] === str[0].toLowerCase() && str.slice(1) !== str.slice(1).toLowerCase()) {
  13. return str;
  14. }
  15. return str.toLowerCase();
  16. }
  17. return str
  18. .replace(/^[_.\- ]+/, '')
  19. .toLowerCase()
  20. .replace(/[_.\- ]+(\w|$)/g, function (m, p1) {
  21. return p1.toUpperCase();
  22. });
  23. };