From d5b7fca072f33e124fd1ff6fccf3dace7a76928e Mon Sep 17 00:00:00 2001 From: Travis CI Date: Sun, 31 Dec 2017 12:45:44 +0000 Subject: [PATCH] Travis build: 720 [ci skip] --- README.md | 2 +- docs/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6659888fa..036edc432 100644 --- a/README.md +++ b/README.md @@ -3418,7 +3418,7 @@ byteSize('Hello World'); // 11
[⬆ Back to top](#table-of-contents) -### Capitalize +### capitalize Capitalizes the first letter of a string. diff --git a/docs/index.html b/docs/index.html index f36e25510..5c06dd1eb 100644 --- a/docs/index.html +++ b/docs/index.html @@ -690,7 +690,7 @@ size({ one: 1, two: 2, three: 3 }); // 3

byteSize

Returns the length of string.

Convert a given string to a Blob Object and find its size.

const byteSize = str => new Blob([str]).size;
 
byteSize('😀'); // 4
 byteSize('Hello World'); // 11
-

Capitalize

Capitalizes the first letter of a string.

Use destructuring and toUpperCase() to capitalize first letter, ...rest to get array of characters after first letter and then Array.join('') to make it a string again. Omit the lowerRest parameter to keep the rest of the string intact, or set it to true to convert to lowercase.

const capitalize = ([first, ...rest], lowerRest = false) =>
+

capitalize

Capitalizes the first letter of a string.

Use destructuring and toUpperCase() to capitalize first letter, ...rest to get array of characters after first letter and then Array.join('') to make it a string again. Omit the lowerRest parameter to keep the rest of the string intact, or set it to true to convert to lowercase.

const capitalize = ([first, ...rest], lowerRest = false) =>
   first.toUpperCase() + (lowerRest ? rest.join('').toLowerCase() : rest.join(''));
 
capitalize('fooBar'); // 'FooBar'
 capitalize('fooBar', true); // 'Foobar'