Skip to content

Commit 1af3a7f

Browse files
committed
Merge pull request #122 from az7arul/issue-98-remove-underscore-prefix
#underscore method does not add the _ prefix for words starting with a u...
2 parents b90fc94 + cd66a57 commit 1af3a7f

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

lib/string.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,9 +567,6 @@ string.js - Copyright (C) 2012-2014, JP Richardson <[email protected]>
567567
//#modified from https://github.com/epeli/underscore.string
568568
underscore: function() {
569569
var s = this.trim().s.replace(/([a-z\d])([A-Z]+)/g, '$1_$2').replace(/[-\s]+/g, '_').toLowerCase();
570-
if ((new S(this.s.charAt(0))).isUpper()) {
571-
s = '_' + s;
572-
}
573570
return new this.constructor(s);
574571
},
575572

test/string.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,9 @@
676676
describe('- underscore()', function() {
677677
it('should convert a camel cased string into a string separated by underscores', function() {
678678
T (S('dataRate').underscore().s === 'data_rate');
679-
T (S('CarSpeed').underscore().s === '_car_speed');
679+
T (S('CarSpeed').underscore().s === 'car_speed');
680+
F (S('CarSpeed').underscore().s === '_car_speed');
681+
T (S('_CarSpeed').underscore().s === '_car_speed');
680682
T (S('yesWeCan').underscore().s === 'yes_we_can');
681683
})
682684
})

0 commit comments

Comments
 (0)