From 1d88d4431d39c64ecacd26efd7ff0a429c86c1f4 Mon Sep 17 00:00:00 2001 From: Pl4gue Date: Thu, 21 Dec 2017 14:05:38 +0000 Subject: [PATCH] Travis build: 15 --- docs/index.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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

Utility

coalesce @@ -1137,14 +1137,6 @@ Combine characters to get a string using join('').

str.split('').sort((a, b) => a.localeCompare(b)).join(''); // sortCharactersInString('cabbage') -> 'aabbceg' -

stringToArrayOfWords

-

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"]
-

toCamelCase

Converts a string to camelcase.

Use replace() to remove underscores, hyphens and spaces and convert words to camelcase.

@@ -1163,6 +1155,14 @@ Return the string truncated to the desired length, with ... appende str.length > num ? str.slice(0, num > 3 ? num - 3 : num) + '...' : str; // truncateString('boomerang', 7) -> 'boom...' +

words

+

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"]
+

Utility

coalesce

Returns the first non-null/undefined argument.