From 5ef9c25163d4c1225f82cf3e58dceb9e2c331b40 Mon Sep 17 00:00:00 2001 From: Arjun Mahishi Date: Wed, 20 Dec 2017 12:54:08 +0530 Subject: [PATCH] Updated description --- snippets/stringToArrayOfWords.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/stringToArrayOfWords.md b/snippets/stringToArrayOfWords.md index 4a7aa7c8a..01bd6eb8b 100644 --- a/snippets/stringToArrayOfWords.md +++ b/snippets/stringToArrayOfWords.md @@ -2,7 +2,7 @@ Converts a given string into an array of words -Use `String.split` to convert the string to an array. +Use String.split with a supplied pattern(defaults to non alpha as a regex) to convert to an Array of Strings and then filter to remove any empty strings. ```js const stringToArrayOfWords = (str, pattern = /[\W_]+/) => str.split(pattern).filter(Boolean)