X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=node_modules%2Fgrunt-legacy-log%2Fnode_modules%2Flodash%2Fstring%2Fwords.js;fp=node_modules%2Fgrunt-legacy-log%2Fnode_modules%2Flodash%2Fstring%2Fwords.js;h=3013ad6301207df763c74290d7790b658189b608;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/node_modules/grunt-legacy-log/node_modules/lodash/string/words.js b/node_modules/grunt-legacy-log/node_modules/lodash/string/words.js new file mode 100644 index 000000000..3013ad630 --- /dev/null +++ b/node_modules/grunt-legacy-log/node_modules/lodash/string/words.js @@ -0,0 +1,38 @@ +var baseToString = require('../internal/baseToString'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** Used to match words to create compound words. */ +var reWords = (function() { + var upper = '[A-Z\\xc0-\\xd6\\xd8-\\xde]', + lower = '[a-z\\xdf-\\xf6\\xf8-\\xff]+'; + + return RegExp(upper + '+(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g'); +}()); + +/** + * Splits `string` into an array of its words. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to inspect. + * @param {RegExp|string} [pattern] The pattern to match words. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the words of `string`. + * @example + * + * _.words('fred, barney, & pebbles'); + * // => ['fred', 'barney', 'pebbles'] + * + * _.words('fred, barney, & pebbles', /[^, ]+/g); + * // => ['fred', 'barney', '&', 'pebbles'] + */ +function words(string, pattern, guard) { + if (guard && isIterateeCall(string, pattern, guard)) { + pattern = undefined; + } + string = baseToString(string); + return string.match(pattern || reWords) || []; +} + +module.exports = words;