Bump to v3.1.0.

This commit is contained in:
jdalton
2015-02-03 22:31:07 -08:00
parent bbec03c4d5
commit 9e749daefa
21 changed files with 127 additions and 66 deletions

View File

@@ -22,7 +22,7 @@ var createCompounder = require('../internal/createCompounder');
*/
var camelCase = createCompounder(function(result, word, index) {
word = word.toLowerCase();
return index ? (result + word.charAt(0).toUpperCase() + word.slice(1)) : word;
return result + (index ? (word.charAt(0).toUpperCase() + word.slice(1)) : word);
});
module.exports = camelCase;

View File

@@ -14,10 +14,10 @@ var createCompounder = require('../internal/createCompounder');
* _.snakeCase('Foo Bar');
* // => 'foo_bar'
*
* _.snakeCase('--foo-bar');
* _.snakeCase('fooBar');
* // => 'foo_bar'
*
* _.snakeCase('fooBar');
* _.snakeCase('--foo-bar');
* // => 'foo_bar'
*/
var snakeCase = createCompounder(function(result, word, index) {

28
string/startCase.js Normal file
View File

@@ -0,0 +1,28 @@
var createCompounder = require('../internal/createCompounder');
/**
* Converts `string` to start case.
* See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage)
* for more details.
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the start cased string.
* @example
*
* _.startCase('--foo-bar');
* // => 'Foo Bar'
*
* _.startCase('fooBar');
* // => 'Foo Bar'
*
* _.startCase('__foo_bar__');
* // => 'Foo Bar'
*/
var startCase = createCompounder(function(result, word, index) {
return result + (index ? ' ' : '') + (word.charAt(0).toUpperCase() + word.slice(1));
});
module.exports = startCase;

View File

@@ -35,7 +35,7 @@ function trim(string, chars, guard) {
if (guard ? isIterateeCall(value, chars, guard) : chars == null) {
return string.slice(trimmedLeftIndex(string), trimmedRightIndex(string) + 1);
}
chars = baseToString(chars);
chars = (chars + '');
return string.slice(charsLeftIndex(string, chars), charsRightIndex(string, chars) + 1);
}

View File

@@ -30,7 +30,7 @@ function trimLeft(string, chars, guard) {
if (guard ? isIterateeCall(value, chars, guard) : chars == null) {
return string.slice(trimmedLeftIndex(string))
}
return string.slice(charsLeftIndex(string, baseToString(chars)));
return string.slice(charsLeftIndex(string, (chars + '')));
}
module.exports = trimLeft;

View File

@@ -30,7 +30,7 @@ function trimRight(string, chars, guard) {
if (guard ? isIterateeCall(value, chars, guard) : chars == null) {
return string.slice(0, trimmedRightIndex(string) + 1)
}
return string.slice(0, charsRightIndex(string, baseToString(chars)) + 1);
return string.slice(0, charsRightIndex(string, (chars + '')) + 1);
}
module.exports = trimRight;