Updated description

This commit is contained in:
Arjun Mahishi
2017-12-20 12:54:08 +05:30
parent 251edb535b
commit 5ef9c25163

View File

@ -2,7 +2,7 @@
Converts a given string into an array of words 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 ```js
const stringToArrayOfWords = (str, pattern = /[\W_]+/) => str.split(pattern).filter(Boolean) const stringToArrayOfWords = (str, pattern = /[\W_]+/) => str.split(pattern).filter(Boolean)