Skip to content

Commit

Permalink
fix underscored method for single letter worlds
Browse files Browse the repository at this point in the history
  • Loading branch information
az7arul committed Mar 16, 2015
1 parent e622437 commit 63450a0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion underscored.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var trim = require('./trim');

module.exports = function underscored(str) {
return trim(str).replace(/([a-z\d])([A-Z]+)/g, '$1_$2').replace(/[-\s]+/g, '_').toLowerCase();
return trim(str).replace(/([a-z\d])([A-Z]+)/g, '$1_$2').replace(/([A-Z\d]+)([A-Z][a-z])/,'$1_$2').replace(/[-\s]+/g, '_').toLowerCase();
};

0 comments on commit 63450a0

Please sign in to comment.