mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
Remove semicolons.
This commit is contained in:
22
words.js
22
words.js
@@ -1,7 +1,7 @@
|
||||
import asciiWords from './.internal/asciiWords.js';
|
||||
import hasUnicodeWord from './.internal/hasUnicodeWord.js';
|
||||
import toString from './toString.js';
|
||||
import unicodeWords from './.internal/unicodeWords.js';
|
||||
import asciiWords from './.internal/asciiWords.js'
|
||||
import hasUnicodeWord from './.internal/hasUnicodeWord.js'
|
||||
import toString from './toString.js'
|
||||
import unicodeWords from './.internal/unicodeWords.js'
|
||||
|
||||
/**
|
||||
* Splits `string` into an array of its words.
|
||||
@@ -14,20 +14,20 @@ import unicodeWords from './.internal/unicodeWords.js';
|
||||
* @returns {Array} Returns the words of `string`.
|
||||
* @example
|
||||
*
|
||||
* words('fred, barney, & pebbles');
|
||||
* words('fred, barney, & pebbles')
|
||||
* // => ['fred', 'barney', 'pebbles']
|
||||
*
|
||||
* words('fred, barney, & pebbles', /[^, ]+/g);
|
||||
* words('fred, barney, & pebbles', /[^, ]+/g)
|
||||
* // => ['fred', 'barney', '&', 'pebbles']
|
||||
*/
|
||||
function words(string, pattern, guard) {
|
||||
string = toString(string);
|
||||
pattern = guard ? undefined : pattern;
|
||||
string = toString(string)
|
||||
pattern = guard ? undefined : pattern
|
||||
|
||||
if (pattern === undefined) {
|
||||
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
|
||||
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string)
|
||||
}
|
||||
return string.match(pattern) || [];
|
||||
return string.match(pattern) || []
|
||||
}
|
||||
|
||||
export default words;
|
||||
export default words
|
||||
|
||||
Reference in New Issue
Block a user