1234567891011121314151617181920212223242526272829303132333435 |
- var asciiWords = require('./_asciiWords'),
- hasUnicodeWord = require('./_hasUnicodeWord'),
- toString = require('./toString'),
- unicodeWords = require('./_unicodeWords');
- function words(string, pattern, guard) {
- string = toString(string);
- pattern = guard ? undefined : pattern;
- if (pattern === undefined) {
- return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
- }
- return string.match(pattern) || [];
- }
- module.exports = words;
|