diff --git a/docs/index.html b/docs/index.html index bad72481f..cda5bb3d4 100644 --- a/docs/index.html +++ b/docs/index.html @@ -163,9 +163,9 @@ fromCamelCase reverseString sortCharactersInString -stringToArrayOfWords toCamelCase truncateString +words
join('').
str.split('').sort((a, b) => a.localeCompare(b)).join('');
// sortCharactersInString('cabbage') -> 'aabbceg'
-Converts a given string into an array of words.
-Use String.split() with a supplied pattern (defaults to non alpha as a regex) to convert to an array of strings. Use Array.filter() to remove any empty strings.
-Omit the second argument to use the default regex.
const stringToArrayOfWords = (str, pattern = /[^a-zA-Z-]+/) => str.split(pattern).filter(Boolean);
-// stringToArrayOfWords("I love javaScript!!") -> ["I", "love", "javaScript"]
-// stringToArrayOfWords("python, javaScript & coffee") -> ["python", "javaScript", "coffee"]
-
Converts a string to camelcase.
Use replace() to remove underscores, hyphens and spaces and convert words to camelcase.
... appende
str.length > num ? str.slice(0, num > 3 ? num - 3 : num) + '...' : str;
// truncateString('boomerang', 7) -> 'boom...'
+Converts a given string into an array of words.
+Use String.split() with a supplied pattern (defaults to non alpha as a regex) to convert to an array of strings. Use Array.filter() to remove any empty strings.
+Omit the second argument to use the default regex.
const words = (str, pattern = /[^a-zA-Z-]+/) => str.split(pattern).filter(Boolean);
+// words("I love javaScript!!") -> ["I", "love", "javaScript"]
+// words("python, javaScript & coffee") -> ["python", "javaScript", "coffee"]
+
Returns the first non-null/undefined argument.