Permalink
Browse files

More sane classify behavior

closes #158
  • Loading branch information...
rwz committed Dec 2, 2012
1 parent 146f72f commit 68ad492d19b2333d839ca295f3b81ea71455a66f
Showing with 3 additions and 1 deletion.
  1. +1 −1 lib/underscore.string.js
  2. +2 −0 test/strings.js
View
@@ -336,7 +336,7 @@
},
classify: function(str){
- return _s.titleize(String(str).replace(/_/g, ' ')).replace(/\s/g, '');
+ return _s.titleize(String(str).replace(/[\W_]/g, ' ')).replace(/\s/g, '');
},
humanize: function(str){
View
@@ -297,6 +297,8 @@ $(document).ready(function() {
test('String: classify', function(){
equal(_.classify(1), '1');
equal(_('some_class_name').classify(), 'SomeClassName');
+ equal(_('my wonderfull class_name').classify(), 'MyWonderfullClassName');
+ equal(_('my wonderfull.class.name').classify(), 'MyWonderfullClassName');
});
test('String: humanize', function(){

0 comments on commit 68ad492

Please sign in to comment.