Sha256: 3c2351f4fa1448bd6d7fe132d1e761db90fccc49146da84af589040b5e7b413b

Contents?: true

Size: 1.16 KB

Versions: 153

Compression:

Stored size: 1.16 KB

Contents

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;

Version data entries

153 entries across 80 versions & 8 rubygems

Version Path
trusty-festivity-extension-2.5.8 node_modules/bower/node_modules/inquirer/node_modules/lodash/string/words.js
trusty-festivity-extension-2.5.8 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/words.js
trusty-festivity-extension-2.5.7 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/words.js
trusty-festivity-extension-2.5.7 node_modules/bower/node_modules/inquirer/node_modules/lodash/string/words.js
trusty-festivity-extension-2.5.6 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/words.js
trusty-festivity-extension-2.5.6 node_modules/bower/node_modules/inquirer/node_modules/lodash/string/words.js
xcodebuild-helper-1.2.3 externals/ios-sim-master/node_modules/lodash/string/words.js
trusty-festivity-extension-2.5.5 node_modules/bower/node_modules/inquirer/node_modules/lodash/string/words.js
trusty-festivity-extension-2.5.5 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/words.js
blackboard-3.1.9 lib/site_template/node_modules/opt-merger/node_modules/lodash/string/words.js
blackboard-3.1.9 lib/site_template/node_modules/easy-extender/node_modules/lodash/string/words.js
babel-schmooze-sprockets-0.1.1 node_modules/lodash/string/words.js
babel-schmooze-sprockets-0.1.0 node_modules/lodash/string/words.js
trusty-festivity-extension-2.5.4 node_modules/bower/node_modules/inquirer/node_modules/lodash/string/words.js
trusty-festivity-extension-2.5.4 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/words.js
trusty-festivity-extension-2.5.3 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/words.js
trusty-festivity-extension-2.5.3 node_modules/bower/node_modules/inquirer/node_modules/lodash/string/words.js
babel-schmooze-sprockets-0.1.0.alpha.3 node_modules/lodash/string/words.js
babel-schmooze-sprockets-0.1.0.alpha.2 node_modules/lodash/string/words.js
trusty-festivity-extension-2.5.2 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/words.js