Нет описания
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  1. /**
  2. * lodash (Custom Build) <https://lodash.com/>
  3. * Build: `lodash modularize exports="npm" -o ./`
  4. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  5. * Released under MIT license <https://lodash.com/license>
  6. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  7. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  8. */
  9. /** Used as references for various `Number` constants. */
  10. var INFINITY = 1 / 0;
  11. /** `Object#toString` result references. */
  12. var symbolTag = '[object Symbol]';
  13. /** Used to match words composed of alphanumeric characters. */
  14. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  15. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  16. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  17. /** Used to compose unicode character classes. */
  18. var rsAstralRange = '\\ud800-\\udfff',
  19. rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
  20. rsComboSymbolsRange = '\\u20d0-\\u20f0',
  21. rsDingbatRange = '\\u2700-\\u27bf',
  22. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  23. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  24. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  25. rsPunctuationRange = '\\u2000-\\u206f',
  26. rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
  27. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  28. rsVarRange = '\\ufe0e\\ufe0f',
  29. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  30. /** Used to compose unicode capture groups. */
  31. var rsApos = "['\u2019]",
  32. rsAstral = '[' + rsAstralRange + ']',
  33. rsBreak = '[' + rsBreakRange + ']',
  34. rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
  35. rsDigits = '\\d+',
  36. rsDingbat = '[' + rsDingbatRange + ']',
  37. rsLower = '[' + rsLowerRange + ']',
  38. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  39. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  40. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  41. rsNonAstral = '[^' + rsAstralRange + ']',
  42. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  43. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  44. rsUpper = '[' + rsUpperRange + ']',
  45. rsZWJ = '\\u200d';
  46. /** Used to compose unicode regexes. */
  47. var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
  48. rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
  49. rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  50. rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  51. reOptMod = rsModifier + '?',
  52. rsOptVar = '[' + rsVarRange + ']?',
  53. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  54. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  55. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  56. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  57. /** Used to match apostrophes. */
  58. var reApos = RegExp(rsApos, 'g');
  59. /**
  60. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  61. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  62. */
  63. var reComboMark = RegExp(rsCombo, 'g');
  64. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  65. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  66. /** Used to match complex or compound words. */
  67. var reUnicodeWord = RegExp([
  68. rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  69. rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
  70. rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
  71. rsUpper + '+' + rsOptUpperContr,
  72. rsDigits,
  73. rsEmoji
  74. ].join('|'), 'g');
  75. /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
  76. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
  77. /** Used to detect strings that need a more robust regexp to match words. */
  78. var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
  79. /** Used to map Latin Unicode letters to basic Latin letters. */
  80. var deburredLetters = {
  81. // Latin-1 Supplement block.
  82. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  83. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  84. '\xc7': 'C', '\xe7': 'c',
  85. '\xd0': 'D', '\xf0': 'd',
  86. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  87. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  88. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  89. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  90. '\xd1': 'N', '\xf1': 'n',
  91. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  92. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  93. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  94. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  95. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  96. '\xc6': 'Ae', '\xe6': 'ae',
  97. '\xde': 'Th', '\xfe': 'th',
  98. '\xdf': 'ss',
  99. // Latin Extended-A block.
  100. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  101. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  102. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  103. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  104. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  105. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  106. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  107. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  108. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  109. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  110. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  111. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  112. '\u0134': 'J', '\u0135': 'j',
  113. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  114. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  115. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  116. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  117. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  118. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  119. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  120. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  121. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  122. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  123. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  124. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  125. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  126. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  127. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  128. '\u0174': 'W', '\u0175': 'w',
  129. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  130. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  131. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  132. '\u0132': 'IJ', '\u0133': 'ij',
  133. '\u0152': 'Oe', '\u0153': 'oe',
  134. '\u0149': "'n", '\u017f': 'ss'
  135. };
  136. /** Detect free variable `global` from Node.js. */
  137. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  138. /** Detect free variable `self`. */
  139. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  140. /** Used as a reference to the global object. */
  141. var root = freeGlobal || freeSelf || Function('return this')();
  142. /**
  143. * A specialized version of `_.reduce` for arrays without support for
  144. * iteratee shorthands.
  145. *
  146. * @private
  147. * @param {Array} [array] The array to iterate over.
  148. * @param {Function} iteratee The function invoked per iteration.
  149. * @param {*} [accumulator] The initial value.
  150. * @param {boolean} [initAccum] Specify using the first element of `array` as
  151. * the initial value.
  152. * @returns {*} Returns the accumulated value.
  153. */
  154. function arrayReduce(array, iteratee, accumulator, initAccum) {
  155. var index = -1,
  156. length = array ? array.length : 0;
  157. if (initAccum && length) {
  158. accumulator = array[++index];
  159. }
  160. while (++index < length) {
  161. accumulator = iteratee(accumulator, array[index], index, array);
  162. }
  163. return accumulator;
  164. }
  165. /**
  166. * Converts an ASCII `string` to an array.
  167. *
  168. * @private
  169. * @param {string} string The string to convert.
  170. * @returns {Array} Returns the converted array.
  171. */
  172. function asciiToArray(string) {
  173. return string.split('');
  174. }
  175. /**
  176. * Splits an ASCII `string` into an array of its words.
  177. *
  178. * @private
  179. * @param {string} The string to inspect.
  180. * @returns {Array} Returns the words of `string`.
  181. */
  182. function asciiWords(string) {
  183. return string.match(reAsciiWord) || [];
  184. }
  185. /**
  186. * The base implementation of `_.propertyOf` without support for deep paths.
  187. *
  188. * @private
  189. * @param {Object} object The object to query.
  190. * @returns {Function} Returns the new accessor function.
  191. */
  192. function basePropertyOf(object) {
  193. return function(key) {
  194. return object == null ? undefined : object[key];
  195. };
  196. }
  197. /**
  198. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  199. * letters to basic Latin letters.
  200. *
  201. * @private
  202. * @param {string} letter The matched letter to deburr.
  203. * @returns {string} Returns the deburred letter.
  204. */
  205. var deburrLetter = basePropertyOf(deburredLetters);
  206. /**
  207. * Checks if `string` contains Unicode symbols.
  208. *
  209. * @private
  210. * @param {string} string The string to inspect.
  211. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  212. */
  213. function hasUnicode(string) {
  214. return reHasUnicode.test(string);
  215. }
  216. /**
  217. * Checks if `string` contains a word composed of Unicode symbols.
  218. *
  219. * @private
  220. * @param {string} string The string to inspect.
  221. * @returns {boolean} Returns `true` if a word is found, else `false`.
  222. */
  223. function hasUnicodeWord(string) {
  224. return reHasUnicodeWord.test(string);
  225. }
  226. /**
  227. * Converts `string` to an array.
  228. *
  229. * @private
  230. * @param {string} string The string to convert.
  231. * @returns {Array} Returns the converted array.
  232. */
  233. function stringToArray(string) {
  234. return hasUnicode(string)
  235. ? unicodeToArray(string)
  236. : asciiToArray(string);
  237. }
  238. /**
  239. * Converts a Unicode `string` to an array.
  240. *
  241. * @private
  242. * @param {string} string The string to convert.
  243. * @returns {Array} Returns the converted array.
  244. */
  245. function unicodeToArray(string) {
  246. return string.match(reUnicode) || [];
  247. }
  248. /**
  249. * Splits a Unicode `string` into an array of its words.
  250. *
  251. * @private
  252. * @param {string} The string to inspect.
  253. * @returns {Array} Returns the words of `string`.
  254. */
  255. function unicodeWords(string) {
  256. return string.match(reUnicodeWord) || [];
  257. }
  258. /** Used for built-in method references. */
  259. var objectProto = Object.prototype;
  260. /**
  261. * Used to resolve the
  262. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  263. * of values.
  264. */
  265. var objectToString = objectProto.toString;
  266. /** Built-in value references. */
  267. var Symbol = root.Symbol;
  268. /** Used to convert symbols to primitives and strings. */
  269. var symbolProto = Symbol ? Symbol.prototype : undefined,
  270. symbolToString = symbolProto ? symbolProto.toString : undefined;
  271. /**
  272. * The base implementation of `_.slice` without an iteratee call guard.
  273. *
  274. * @private
  275. * @param {Array} array The array to slice.
  276. * @param {number} [start=0] The start position.
  277. * @param {number} [end=array.length] The end position.
  278. * @returns {Array} Returns the slice of `array`.
  279. */
  280. function baseSlice(array, start, end) {
  281. var index = -1,
  282. length = array.length;
  283. if (start < 0) {
  284. start = -start > length ? 0 : (length + start);
  285. }
  286. end = end > length ? length : end;
  287. if (end < 0) {
  288. end += length;
  289. }
  290. length = start > end ? 0 : ((end - start) >>> 0);
  291. start >>>= 0;
  292. var result = Array(length);
  293. while (++index < length) {
  294. result[index] = array[index + start];
  295. }
  296. return result;
  297. }
  298. /**
  299. * The base implementation of `_.toString` which doesn't convert nullish
  300. * values to empty strings.
  301. *
  302. * @private
  303. * @param {*} value The value to process.
  304. * @returns {string} Returns the string.
  305. */
  306. function baseToString(value) {
  307. // Exit early for strings to avoid a performance hit in some environments.
  308. if (typeof value == 'string') {
  309. return value;
  310. }
  311. if (isSymbol(value)) {
  312. return symbolToString ? symbolToString.call(value) : '';
  313. }
  314. var result = (value + '');
  315. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  316. }
  317. /**
  318. * Casts `array` to a slice if it's needed.
  319. *
  320. * @private
  321. * @param {Array} array The array to inspect.
  322. * @param {number} start The start position.
  323. * @param {number} [end=array.length] The end position.
  324. * @returns {Array} Returns the cast slice.
  325. */
  326. function castSlice(array, start, end) {
  327. var length = array.length;
  328. end = end === undefined ? length : end;
  329. return (!start && end >= length) ? array : baseSlice(array, start, end);
  330. }
  331. /**
  332. * Creates a function like `_.lowerFirst`.
  333. *
  334. * @private
  335. * @param {string} methodName The name of the `String` case method to use.
  336. * @returns {Function} Returns the new case function.
  337. */
  338. function createCaseFirst(methodName) {
  339. return function(string) {
  340. string = toString(string);
  341. var strSymbols = hasUnicode(string)
  342. ? stringToArray(string)
  343. : undefined;
  344. var chr = strSymbols
  345. ? strSymbols[0]
  346. : string.charAt(0);
  347. var trailing = strSymbols
  348. ? castSlice(strSymbols, 1).join('')
  349. : string.slice(1);
  350. return chr[methodName]() + trailing;
  351. };
  352. }
  353. /**
  354. * Creates a function like `_.camelCase`.
  355. *
  356. * @private
  357. * @param {Function} callback The function to combine each word.
  358. * @returns {Function} Returns the new compounder function.
  359. */
  360. function createCompounder(callback) {
  361. return function(string) {
  362. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  363. };
  364. }
  365. /**
  366. * Checks if `value` is object-like. A value is object-like if it's not `null`
  367. * and has a `typeof` result of "object".
  368. *
  369. * @static
  370. * @memberOf _
  371. * @since 4.0.0
  372. * @category Lang
  373. * @param {*} value The value to check.
  374. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  375. * @example
  376. *
  377. * _.isObjectLike({});
  378. * // => true
  379. *
  380. * _.isObjectLike([1, 2, 3]);
  381. * // => true
  382. *
  383. * _.isObjectLike(_.noop);
  384. * // => false
  385. *
  386. * _.isObjectLike(null);
  387. * // => false
  388. */
  389. function isObjectLike(value) {
  390. return !!value && typeof value == 'object';
  391. }
  392. /**
  393. * Checks if `value` is classified as a `Symbol` primitive or object.
  394. *
  395. * @static
  396. * @memberOf _
  397. * @since 4.0.0
  398. * @category Lang
  399. * @param {*} value The value to check.
  400. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  401. * @example
  402. *
  403. * _.isSymbol(Symbol.iterator);
  404. * // => true
  405. *
  406. * _.isSymbol('abc');
  407. * // => false
  408. */
  409. function isSymbol(value) {
  410. return typeof value == 'symbol' ||
  411. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  412. }
  413. /**
  414. * Converts `value` to a string. An empty string is returned for `null`
  415. * and `undefined` values. The sign of `-0` is preserved.
  416. *
  417. * @static
  418. * @memberOf _
  419. * @since 4.0.0
  420. * @category Lang
  421. * @param {*} value The value to process.
  422. * @returns {string} Returns the string.
  423. * @example
  424. *
  425. * _.toString(null);
  426. * // => ''
  427. *
  428. * _.toString(-0);
  429. * // => '-0'
  430. *
  431. * _.toString([1, 2, 3]);
  432. * // => '1,2,3'
  433. */
  434. function toString(value) {
  435. return value == null ? '' : baseToString(value);
  436. }
  437. /**
  438. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  439. *
  440. * @static
  441. * @memberOf _
  442. * @since 3.0.0
  443. * @category String
  444. * @param {string} [string=''] The string to convert.
  445. * @returns {string} Returns the camel cased string.
  446. * @example
  447. *
  448. * _.camelCase('Foo Bar');
  449. * // => 'fooBar'
  450. *
  451. * _.camelCase('--foo-bar--');
  452. * // => 'fooBar'
  453. *
  454. * _.camelCase('__FOO_BAR__');
  455. * // => 'fooBar'
  456. */
  457. var camelCase = createCompounder(function(result, word, index) {
  458. word = word.toLowerCase();
  459. return result + (index ? capitalize(word) : word);
  460. });
  461. /**
  462. * Converts the first character of `string` to upper case and the remaining
  463. * to lower case.
  464. *
  465. * @static
  466. * @memberOf _
  467. * @since 3.0.0
  468. * @category String
  469. * @param {string} [string=''] The string to capitalize.
  470. * @returns {string} Returns the capitalized string.
  471. * @example
  472. *
  473. * _.capitalize('FRED');
  474. * // => 'Fred'
  475. */
  476. function capitalize(string) {
  477. return upperFirst(toString(string).toLowerCase());
  478. }
  479. /**
  480. * Deburrs `string` by converting
  481. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  482. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  483. * letters to basic Latin letters and removing
  484. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  485. *
  486. * @static
  487. * @memberOf _
  488. * @since 3.0.0
  489. * @category String
  490. * @param {string} [string=''] The string to deburr.
  491. * @returns {string} Returns the deburred string.
  492. * @example
  493. *
  494. * _.deburr('déjà vu');
  495. * // => 'deja vu'
  496. */
  497. function deburr(string) {
  498. string = toString(string);
  499. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  500. }
  501. /**
  502. * Converts the first character of `string` to upper case.
  503. *
  504. * @static
  505. * @memberOf _
  506. * @since 4.0.0
  507. * @category String
  508. * @param {string} [string=''] The string to convert.
  509. * @returns {string} Returns the converted string.
  510. * @example
  511. *
  512. * _.upperFirst('fred');
  513. * // => 'Fred'
  514. *
  515. * _.upperFirst('FRED');
  516. * // => 'FRED'
  517. */
  518. var upperFirst = createCaseFirst('toUpperCase');
  519. /**
  520. * Splits `string` into an array of its words.
  521. *
  522. * @static
  523. * @memberOf _
  524. * @since 3.0.0
  525. * @category String
  526. * @param {string} [string=''] The string to inspect.
  527. * @param {RegExp|string} [pattern] The pattern to match words.
  528. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  529. * @returns {Array} Returns the words of `string`.
  530. * @example
  531. *
  532. * _.words('fred, barney, & pebbles');
  533. * // => ['fred', 'barney', 'pebbles']
  534. *
  535. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  536. * // => ['fred', 'barney', '&', 'pebbles']
  537. */
  538. function words(string, pattern, guard) {
  539. string = toString(string);
  540. pattern = guard ? undefined : pattern;
  541. if (pattern === undefined) {
  542. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  543. }
  544. return string.match(pattern) || [];
  545. }
  546. module.exports = camelCase;