2570805ecab90ced42a5805192f27dd9eae6431c3a0d190121b2e0d6b2f2d0790f3318f4a34e3ee44b201fbd44fb0bed09f087ef06a87dcf9e687d5fe3e823 73 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137
  1. import _ = require("../index");
  2. // Helper types to reject readonly arrays
  3. type _Eq<T, U> = (<X>() => X extends T ? 1 : 2) extends (<X>() => X extends U ? 1 : 2) ? true : false
  4. type _IsWritable<T> = _Eq<{ [K in keyof T]: T[K] }, { -readonly [K in keyof T]: T[K] }>
  5. type RejectReadonly<T extends _.MutableList<unknown>> = _IsWritable<T> extends true ? T : never
  6. export {}
  7. declare module "../index" {
  8. interface LoDashStatic {
  9. /**
  10. * Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the
  11. * final chunk will be the remaining elements.
  12. *
  13. * @param array The array to process.
  14. * @param size The length of each chunk.
  15. * @return Returns the new array containing chunks.
  16. */
  17. chunk<T>(array: List<T> | null | undefined, size?: number): T[][];
  18. }
  19. interface Collection<T> {
  20. /**
  21. * @see _.chunk
  22. */
  23. chunk(size?: number): Collection<T[]>;
  24. }
  25. interface CollectionChain<T> {
  26. /**
  27. * @see _.chunk
  28. */
  29. chunk(size?: number): CollectionChain<T[]>;
  30. }
  31. interface LoDashStatic {
  32. /**
  33. * Creates an array with all falsey values removed. The values false, null, 0, 0n, "", undefined, and NaN are
  34. * falsey.
  35. *
  36. * @param array The array to compact.
  37. * @return Returns the new array of filtered values.
  38. */
  39. compact<T>(array: List<T | Falsey> | null | undefined): T[];
  40. }
  41. type Falsey = null | undefined | false | "" | 0 | 0n;
  42. type Truthy<T> = T extends Falsey ? never : T;
  43. interface Collection<T> {
  44. /**
  45. * @see _.compact
  46. */
  47. compact(): Collection<Truthy<T>>;
  48. }
  49. interface CollectionChain<T> {
  50. /**
  51. * @see _.compact
  52. */
  53. compact(): CollectionChain<Truthy<T>>;
  54. }
  55. interface LoDashStatic {
  56. /**
  57. * Creates a new array concatenating `array` with any additional arrays
  58. * and/or values.
  59. *
  60. * @category Array
  61. * @param [values] The array values to concatenate.
  62. * @returns Returns the new concatenated array.
  63. * @example
  64. *
  65. * var array = [1];
  66. * var other = _.concat(array, 2, [3], [[4]]);
  67. *
  68. * console.log(other);
  69. * // => [1, 2, 3, [4]]
  70. *
  71. * console.log(array);
  72. * // => [1]
  73. */
  74. concat<T>(...values: Array<Many<T>>): T[];
  75. }
  76. interface Primitive<T> {
  77. /**
  78. * @see _.concat
  79. */
  80. concat(...values: Array<Many<T>>): Collection<T>;
  81. }
  82. interface Collection<T> {
  83. /**
  84. * @see _.concat
  85. */
  86. concat(...values: Array<Many<T>>): Collection<T>;
  87. }
  88. interface Object<T> {
  89. /**
  90. * @see _.concat
  91. */
  92. concat(...values: Array<Many<T>>): Collection<T>;
  93. }
  94. interface PrimitiveChain<T> {
  95. /**
  96. * @see _.concat
  97. */
  98. concat(...values: Array<Many<T>>): CollectionChain<T>;
  99. }
  100. interface CollectionChain<T> {
  101. /**
  102. * @see _.concat
  103. */
  104. concat(...values: Array<Many<T>>): CollectionChain<T>;
  105. }
  106. interface ObjectChain<T> {
  107. /**
  108. * @see _.concat
  109. */
  110. concat(...values: Array<Many<T>>): CollectionChain<T>;
  111. }
  112. interface LoDashStatic {
  113. /**
  114. * Creates an array of `array` values not included in the other provided arrays using SameValueZero for
  115. * equality comparisons. The order and references of result values are determined by the first array.
  116. *
  117. * @param array The array to inspect.
  118. * @param values The arrays of values to exclude.
  119. * @return Returns the new array of filtered values.
  120. */
  121. difference<T>(array: List<T> | null | undefined, ...values: Array<List<T>>): T[];
  122. }
  123. interface Collection<T> {
  124. /**
  125. * @see _.difference
  126. */
  127. difference(...values: Array<List<T>>): Collection<T>;
  128. }
  129. interface CollectionChain<T> {
  130. /**
  131. * @see _.difference
  132. */
  133. difference(...values: Array<List<T>>): CollectionChain<T>;
  134. }
  135. interface LoDashStatic {
  136. /**
  137. * This method is like _.difference except that it accepts iteratee which is invoked for each element
  138. * of array and values to generate the criterion by which they're compared. The order and references
  139. * of result values are determined by the first array. The iteratee is invoked with one argument: (value).
  140. *
  141. * @param array The array to inspect.
  142. * @param values The values to exclude.
  143. * @param iteratee The iteratee invoked per element.
  144. * @returns Returns the new array of filtered values.
  145. */
  146. differenceBy<T1, T2>(array: List<T1> | null | undefined, values: List<T2>, iteratee: ValueIteratee<T1 | T2>): T1[];
  147. /**
  148. * @see _.differenceBy
  149. */
  150. differenceBy<T1, T2, T3>(array: List<T1> | null | undefined, values1: List<T2>, values2: List<T3>, iteratee: ValueIteratee<T1 | T2 | T3>): T1[];
  151. /**
  152. * @see _.differenceBy
  153. */
  154. differenceBy<T1, T2, T3, T4>(array: List<T1> | null | undefined, values1: List<T2>, values2: List<T3>, values3: List<T4>, iteratee: ValueIteratee<T1 | T2 | T3 | T4>): T1[];
  155. /**
  156. * @see _.differenceBy
  157. */
  158. differenceBy<T1, T2, T3, T4, T5>(array: List<T1> | null | undefined, values1: List<T2>, values2: List<T3>, values3: List<T4>, values4: List<T5>, iteratee: ValueIteratee<T1 | T2 | T3 | T4 | T5>): T1[];
  159. /**
  160. * @see _.differenceBy
  161. */
  162. differenceBy<T1, T2, T3, T4, T5, T6>(array: List<T1> | null | undefined, values1: List<T2>, values2: List<T3>, values3: List<T4>, values4: List<T5>, values5: List<T6>, iteratee: ValueIteratee<T1 | T2 | T3 | T4 | T5 | T6>): T1[];
  163. /**
  164. * @see _.differenceBy
  165. */
  166. differenceBy<T1, T2, T3, T4, T5, T6, T7>(array: List<T1> | null | undefined, values1: List<T2>, values2: List<T3>, values3: List<T4>, values4: List<T5>, values5: List<T6>, ...values: Array<List<T7> | ValueIteratee<T1 | T2 | T3 | T4 | T5 | T6 | T7>>): T1[];
  167. /**
  168. * @see _.differenceBy
  169. */
  170. differenceBy<T>(array: List<T> | null | undefined, ...values: Array<List<T>>): T[];
  171. }
  172. interface Collection<T> {
  173. /**
  174. * @see _.differenceBy
  175. */
  176. differenceBy<T2>(values1: List<T2>, iteratee?: ValueIteratee<T | T2>): Collection<T>;
  177. /**
  178. * @see _.differenceBy
  179. */
  180. differenceBy(...values: Array<List<unknown> | ValueIteratee<T>>): Collection<T>;
  181. }
  182. interface CollectionChain<T> {
  183. /**
  184. * @see _.differenceBy
  185. */
  186. differenceBy<T2>(values1: List<T2>, iteratee?: ValueIteratee<T | T2>): CollectionChain<T>;
  187. /**
  188. * @see _.differenceBy
  189. */
  190. differenceBy(...values: Array<List<unknown> | ValueIteratee<T>>): CollectionChain<T>;
  191. }
  192. interface LoDashStatic {
  193. /**
  194. * This method is like _.difference except that it accepts comparator which is invoked to compare elements
  195. * of array to values. The order and references of result values are determined by the first array. The
  196. * comparator is invoked with two arguments: (arrVal, othVal).
  197. *
  198. * @category Array
  199. * @param [values] The arrays to inspect.
  200. * @param [comparator] The comparator invoked per element.
  201. * @returns Returns the new array of filtered values.
  202. * @example
  203. *
  204. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  205. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  206. * // => [{ 'x': 2, 'y': 1 }]
  207. */
  208. differenceWith<T1, T2>(array: List<T1> | null | undefined, values: List<T2>, comparator: Comparator2<T1, T2>): T1[];
  209. /**
  210. * @see _.differenceWith
  211. */
  212. differenceWith<T1, T2, T3>(array: List<T1> | null | undefined, values1: List<T2>, values2: List<T3>, comparator: Comparator2<T1, T2 | T3>): T1[];
  213. /**
  214. * @see _.differenceWith
  215. */
  216. differenceWith<T1, T2, T3, T4>(array: List<T1> | null | undefined, values1: List<T2>, values2: List<T3>, ...values: Array<List<T4> | Comparator2<T1, T2 | T3 | T4>>): T1[];
  217. /**
  218. * @see _.differenceWith
  219. */
  220. differenceWith<T>(array: List<T> | null | undefined, ...values: Array<List<T>>): T[];
  221. }
  222. interface Collection<T> {
  223. /**
  224. * @see _.differenceWith
  225. */
  226. differenceWith<T2>(values: List<T2>, comparator: Comparator2<T, T2>): Collection<T>;
  227. /**
  228. * @see _.differenceWith
  229. */
  230. differenceWith<T2, T3, T4>(...values: Array<List<unknown> | Comparator2<T, never>>): Collection<T>;
  231. }
  232. interface CollectionChain<T> {
  233. /**
  234. * @see _.differenceWith
  235. */
  236. differenceWith< T2>(values: List<T2>, comparator: Comparator2<T, T2>): CollectionChain<T>;
  237. /**
  238. * @see _.differenceWith
  239. */
  240. differenceWith< T2, T3, T4>(...values: Array<List<unknown> | Comparator2<T, never>>): CollectionChain<T>;
  241. }
  242. interface LoDashStatic {
  243. /**
  244. * Creates a slice of array with n elements dropped from the beginning.
  245. *
  246. * @param array The array to query.
  247. * @param n The number of elements to drop.
  248. * @return Returns the slice of array.
  249. */
  250. drop<T>(array: List<T> | null | undefined, n?: number): T[];
  251. }
  252. interface Collection<T> {
  253. /**
  254. * @see _.drop
  255. */
  256. drop(n?: number): Collection<T>;
  257. }
  258. interface CollectionChain<T> {
  259. /**
  260. * @see _.drop
  261. */
  262. drop(n?: number): CollectionChain<T>;
  263. }
  264. interface LoDashStatic {
  265. /**
  266. * Creates a slice of array with n elements dropped from the end.
  267. *
  268. * @param array The array to query.
  269. * @param n The number of elements to drop.
  270. * @return Returns the slice of array.
  271. */
  272. dropRight<T>(array: List<T> | null | undefined, n?: number): T[];
  273. }
  274. interface Collection<T> {
  275. /**
  276. * @see _.dropRight
  277. */
  278. dropRight(n?: number): Collection<T>;
  279. }
  280. interface CollectionChain<T> {
  281. /**
  282. * @see _.dropRight
  283. */
  284. dropRight(n?: number): CollectionChain<T>;
  285. }
  286. interface LoDashStatic {
  287. /**
  288. * Creates a slice of array excluding elements dropped from the end. Elements are dropped until predicate
  289. * returns falsey. The predicate is invoked with three arguments: (value, index, array).
  290. *
  291. * @param array The array to query.
  292. * @param predicate The function invoked per iteration.
  293. * @return Returns the slice of array.
  294. */
  295. dropRightWhile<T>(array: List<T> | null | undefined, predicate?: ListIteratee<T>): T[];
  296. }
  297. interface Collection<T> {
  298. /**
  299. * @see _.dropRightWhile
  300. */
  301. dropRightWhile(predicate?: ListIteratee<T>): Collection<T>;
  302. }
  303. interface CollectionChain<T> {
  304. /**
  305. * @see _.dropRightWhile
  306. */
  307. dropRightWhile(predicate?: ListIteratee<T>): CollectionChain<T>;
  308. }
  309. interface LoDashStatic {
  310. /**
  311. * Creates a slice of array excluding elements dropped from the beginning. Elements are dropped until predicate
  312. * returns falsey. The predicate is invoked with three arguments: (value, index, array).
  313. *
  314. * @param array The array to query.
  315. * @param predicate The function invoked per iteration.
  316. * @return Returns the slice of array.
  317. */
  318. dropWhile<T>(array: List<T> | null | undefined, predicate?: ListIteratee<T>): T[];
  319. }
  320. interface Collection<T> {
  321. /**
  322. * @see _.dropWhile
  323. */
  324. dropWhile(predicate?: ListIteratee<T>): Collection<T>;
  325. }
  326. interface CollectionChain<T> {
  327. /**
  328. * @see _.dropWhile
  329. */
  330. dropWhile(predicate?: ListIteratee<T>): CollectionChain<T>;
  331. }
  332. interface LoDashStatic {
  333. /**
  334. * Fills elements of array with value from start up to, but not including, end.
  335. *
  336. * Note: This method mutates array.
  337. *
  338. * @param array The array to fill.
  339. * @param value The value to fill array with.
  340. * @param start The start position.
  341. * @param end The end position.
  342. * @return Returns array.
  343. */
  344. fill<T>(array: any[] | null | undefined, value: T): T[];
  345. /**
  346. * @see _.fill
  347. */
  348. fill<T, AnyList extends MutableList<any>>(array: RejectReadonly<AnyList> | null | undefined, value: T): List<T>;
  349. /**
  350. * @see _.fill
  351. */
  352. fill<T, U>(array: U[] | null | undefined, value: T, start?: number, end?: number): Array<T | U>;
  353. /**
  354. * @see _.fill
  355. */
  356. fill<T, UList extends MutableList<any>>(array: RejectReadonly<UList> | null | undefined, value: T, start?: number, end?: number): List<T | UList[0]>;
  357. }
  358. interface Collection<T> {
  359. /**
  360. * @see _.fill
  361. */
  362. fill<U>(value: U, start?: number, end?: number): Collection<T | U>;
  363. }
  364. interface CollectionChain<T> {
  365. /**
  366. * @see _.fill
  367. */
  368. fill<U>(value: U, start?: number, end?: number): CollectionChain<T | U>;
  369. }
  370. interface LoDashStatic {
  371. /**
  372. * This method is like _.find except that it returns the index of the first element predicate returns truthy
  373. * for instead of the element itself.
  374. *
  375. * @param array The array to search.
  376. * @param predicate The function invoked per iteration.
  377. * @param fromIndex The index to search from.
  378. * @return Returns the index of the found element, else -1.
  379. */
  380. findIndex<T>(array: List<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): number;
  381. }
  382. interface Collection<T> {
  383. /**
  384. * @see _.findIndex
  385. */
  386. findIndex(predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): number;
  387. }
  388. interface CollectionChain<T> {
  389. /**
  390. * @see _.findIndex
  391. */
  392. findIndex(predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): PrimitiveChain<number>;
  393. }
  394. interface LoDashStatic {
  395. /**
  396. * This method is like _.findIndex except that it iterates over elements of collection from right to left.
  397. *
  398. * @param array The array to search.
  399. * @param predicate The function invoked per iteration.
  400. * @param fromIndex The index to search from.
  401. * @return Returns the index of the found element, else -1.
  402. */
  403. findLastIndex<T>(array: List<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): number;
  404. }
  405. interface Collection<T> {
  406. /**
  407. * @see _.findLastIndex
  408. */
  409. findLastIndex(predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): number;
  410. }
  411. interface CollectionChain<T> {
  412. /**
  413. * @see _.findLastIndex
  414. */
  415. findLastIndex(predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): PrimitiveChain<number>;
  416. }
  417. interface LoDashStatic {
  418. /**
  419. * @see _.head
  420. */
  421. first: LoDashStatic["head"];
  422. }
  423. interface String {
  424. /**
  425. * @see _.first
  426. */
  427. first(): string | undefined;
  428. }
  429. interface StringChain {
  430. /**
  431. * @see _.first
  432. */
  433. first(): StringNullableChain;
  434. }
  435. interface StringNullableChain {
  436. /**
  437. * @see _.first
  438. */
  439. first(): StringNullableChain;
  440. }
  441. interface Collection<T> {
  442. /**
  443. * @see _.first
  444. */
  445. first(): T | undefined;
  446. }
  447. interface CollectionChain<T> {
  448. /**
  449. * @see _.first
  450. */
  451. first(): ExpChain<T | undefined>;
  452. }
  453. interface RecursiveArray<T> extends Array<T|RecursiveArray<T>> {}
  454. interface ListOfRecursiveArraysOrValues<T> extends List<T|RecursiveArray<T>> {}
  455. interface LoDashStatic {
  456. /**
  457. * Flattens `array` a single level deep.
  458. *
  459. * @param array The array to flatten.
  460. * @return Returns the new flattened array.
  461. */
  462. flatten<T>(array: List<Many<T>> | null | undefined): T[];
  463. }
  464. interface String {
  465. /**
  466. * @see _.flatten
  467. */
  468. flatten(): Collection<string>;
  469. }
  470. interface StringChain {
  471. /**
  472. * @see _.flatten
  473. */
  474. flatten(): CollectionChain<string>;
  475. }
  476. interface StringNullableChain {
  477. /**
  478. * @see _.flatten
  479. */
  480. flatten(): CollectionChain<string>;
  481. }
  482. interface Collection<T> {
  483. /**
  484. * @see _.flatten
  485. */
  486. flatten(): T extends Many<infer U> ? Collection<U> : Collection<T>;
  487. }
  488. interface CollectionChain<T> {
  489. /**
  490. * @see _.flatten
  491. */
  492. flatten(): T extends Many<infer U> ? CollectionChain<U> : CollectionChain<T>;
  493. }
  494. type Flat<T> = T extends string ? T : (T extends List<any> ? never : T);
  495. interface LoDashStatic {
  496. /**
  497. * Recursively flattens a nested array.
  498. *
  499. * @param array The array to recursively flatten.
  500. * @return Returns the new flattened array.
  501. */
  502. flattenDeep<T>(array: ListOfRecursiveArraysOrValues<T> | null | undefined): Array<Flat<T>>;
  503. }
  504. interface Collection<T> {
  505. /**
  506. * @see _.flattenDeep
  507. */
  508. flattenDeep(): T extends ListOfRecursiveArraysOrValues<infer U> ? Collection<Flat<U>> : Collection<T>;
  509. }
  510. interface CollectionChain<T> {
  511. /**
  512. * @see _.flattenDeep
  513. */
  514. flattenDeep(): T extends ListOfRecursiveArraysOrValues<infer U> ? CollectionChain<Flat<U>> : CollectionChain<T>;
  515. }
  516. interface LoDashStatic {
  517. /**
  518. * Recursively flatten array up to depth times.
  519. *
  520. * @param array The array to recursively flatten.
  521. * @param number The maximum recursion depth.
  522. * @return Returns the new flattened array.
  523. */
  524. flattenDepth<T>(array: ListOfRecursiveArraysOrValues<T> | null | undefined, depth?: number): T[];
  525. }
  526. interface Collection<T> {
  527. /**
  528. * @see _.flattenDepth
  529. */
  530. flattenDepth(depth?: number): Collection<T>;
  531. }
  532. interface CollectionChain<T> {
  533. /**
  534. * @see _.flattenDepth
  535. */
  536. flattenDepth(depth?: number): CollectionChain<T>;
  537. }
  538. interface LoDashStatic {
  539. /**
  540. * The inverse of `_.toPairs`; this method returns an object composed
  541. * from key-value `pairs`.
  542. *
  543. * @category Array
  544. * @param pairs The key-value pairs.
  545. * @returns Returns the new object.
  546. * @example
  547. *
  548. * _.fromPairs([['fred', 30], ['barney', 40]]);
  549. * // => { 'fred': 30, 'barney': 40 }
  550. */
  551. fromPairs<T>(pairs: List<[PropertyName, T]> | null | undefined): Dictionary<T>;
  552. /**
  553. * @see _.fromPairs
  554. */
  555. fromPairs(pairs: List<any[]> | null | undefined): Dictionary<any>;
  556. }
  557. interface Collection<T> {
  558. /**
  559. * @see _.fromPairs
  560. */
  561. fromPairs(): Object<Dictionary<T extends [PropertyName, infer U] ? U : any>>;
  562. }
  563. interface CollectionChain<T> {
  564. /**
  565. * @see _.fromPairs
  566. */
  567. fromPairs(): ObjectChain<Dictionary<T extends [PropertyName, infer U] ? U : any>>;
  568. }
  569. interface LoDashStatic {
  570. /**
  571. * Gets the first element of array.
  572. *
  573. * @alias _.first
  574. *
  575. * @param array The array to query.
  576. * @return Returns the first element of array.
  577. */
  578. head<T>(array: readonly [T, ...unknown[]]): T;
  579. head<T>(array: List<T> | null | undefined): T | undefined;
  580. }
  581. interface String {
  582. /**
  583. * @see _.head
  584. */
  585. head(): string | undefined;
  586. }
  587. interface StringChain {
  588. /**
  589. * @see _.head
  590. */
  591. head(): StringNullableChain;
  592. }
  593. interface StringNullableChain {
  594. /**
  595. * @see _.head
  596. */
  597. head(): StringNullableChain;
  598. }
  599. interface Collection<T> {
  600. /**
  601. * @see _.head
  602. */
  603. head(): T | undefined;
  604. }
  605. interface CollectionChain<T> {
  606. /**
  607. * @see _.head
  608. */
  609. head(): ExpChain<T | undefined>;
  610. }
  611. interface LoDashStatic {
  612. /**
  613. * Gets the index at which the first occurrence of `value` is found in `array`
  614. * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
  615. * for equality comparisons. If `fromIndex` is negative, it's used as the offset
  616. * from the end of `array`.
  617. *
  618. * @category Array
  619. * @param array The array to search.
  620. * @param value The value to search for.
  621. * @param [fromIndex=0] The index to search from.
  622. * @returns Returns the index of the matched value, else `-1`.
  623. * @example
  624. *
  625. * _.indexOf([1, 2, 1, 2], 2);
  626. * // => 1
  627. *
  628. * // using `fromIndex`
  629. * _.indexOf([1, 2, 1, 2], 2, 2);
  630. * // => 3
  631. */
  632. indexOf<T>(array: List<T> | null | undefined, value: T, fromIndex?: number): number;
  633. }
  634. interface Collection<T> {
  635. /**
  636. * @see _.indexOf
  637. */
  638. indexOf(value: T, fromIndex?: number): number;
  639. }
  640. interface CollectionChain<T> {
  641. /**
  642. * @see _.indexOf
  643. */
  644. indexOf(value: T, fromIndex?: number): PrimitiveChain<number>;
  645. }
  646. interface LoDashStatic {
  647. /**
  648. * Gets all but the last element of array.
  649. *
  650. * @param array The array to query.
  651. * @return Returns the slice of array.
  652. */
  653. initial<T>(array: List<T> | null | undefined): T[];
  654. }
  655. interface Collection<T> {
  656. /**
  657. * @see _.initial
  658. */
  659. initial(): Collection<T>;
  660. }
  661. interface CollectionChain<T> {
  662. /**
  663. * @see _.initial
  664. */
  665. initial(): CollectionChain<T>;
  666. }
  667. interface LoDashStatic {
  668. /**
  669. * Creates an array of unique values that are included in all of the provided arrays using SameValueZero for
  670. * equality comparisons.
  671. *
  672. * @param arrays The arrays to inspect.
  673. * @return Returns the new array of shared values.
  674. */
  675. intersection<T>(...arrays: Array<List<T> | null | undefined>): T[];
  676. }
  677. interface Collection<T> {
  678. /**
  679. * @see _.intersection
  680. */
  681. intersection(...arrays: Array<List<T> | null | undefined>): Collection<T>;
  682. }
  683. interface CollectionChain<T> {
  684. /**
  685. * @see _.intersection
  686. */
  687. intersection(...arrays: Array<List<T> | null | undefined>): CollectionChain<T>;
  688. }
  689. interface LoDashStatic {
  690. /**
  691. * This method is like `_.intersection` except that it accepts `iteratee`
  692. * which is invoked for each element of each `arrays` to generate the criterion
  693. * by which uniqueness is computed. The iteratee is invoked with one argument: (value).
  694. *
  695. * @category Array
  696. * @param [arrays] The arrays to inspect.
  697. * @param [iteratee=_.identity] The iteratee invoked per element.
  698. * @returns Returns the new array of shared values.
  699. * @example
  700. *
  701. * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor);
  702. * // => [2.1]
  703. *
  704. * // using the `_.property` iteratee shorthand
  705. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  706. * // => [{ 'x': 1 }]
  707. */
  708. intersectionBy<T1, T2>(array: List<T1> | null, values: List<T2>, iteratee: ValueIteratee<T1 | T2>): T1[];
  709. /**
  710. * @see _.intersectionBy
  711. */
  712. intersectionBy<T1, T2, T3>(array: List<T1> | null, values1: List<T2>, values2: List<T3>, iteratee: ValueIteratee<T1 | T2 | T3>): T1[];
  713. /**
  714. * @see _.intersectionBy
  715. */
  716. intersectionBy<T1, T2, T3, T4>(array: List<T1> | null | undefined, values1: List<T2>, values2: List<T3>, ...values: Array<List<T4> | ValueIteratee<T1 | T2 | T3 | T4>>): T1[];
  717. /**
  718. * @see _.intersectionBy
  719. */
  720. intersectionBy<T>(array?: List<T> | null, ...values: Array<List<T>>): T[];
  721. /**
  722. * @see _.intersectionBy
  723. */
  724. intersectionBy<T>(...values: Array<List<T> | ValueIteratee<T>>): T[];
  725. }
  726. interface Collection<T> {
  727. /**
  728. * @see _.intersectionBy
  729. */
  730. intersectionBy<T2>(values: List<T2>, iteratee: ValueIteratee<T | T2>): Collection<T>;
  731. /**
  732. * @see _.intersectionBy
  733. */
  734. intersectionBy(...values: Array<List<unknown> | ValueIteratee<T>>): Collection<T>;
  735. }
  736. interface CollectionChain<T> {
  737. /**
  738. * @see _.intersectionBy
  739. */
  740. intersectionBy<T2>(values: List<T2>, iteratee: ValueIteratee<T | T2>): CollectionChain<T>;
  741. /**
  742. * @see _.intersectionBy
  743. */
  744. intersectionBy(...values: Array<List<unknown> | ValueIteratee<T>>): CollectionChain<T>;
  745. }
  746. interface LoDashStatic {
  747. /**
  748. * Creates an array of unique `array` values not included in the other
  749. * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
  750. * for equality comparisons.
  751. *
  752. * @category Array
  753. * @param [values] The arrays to inspect.
  754. * @param [comparator] The comparator invoked per element.
  755. * @returns Returns the new array of filtered values.
  756. * @example
  757. *
  758. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  759. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  760. * _.intersectionWith(objects, others, _.isEqual);
  761. * // => [{ 'x': 1, 'y': 2 }]
  762. */
  763. intersectionWith<T1, T2>(array: List<T1> | null | undefined, values: List<T2>, comparator: Comparator2<T1, T1 | T2>): T1[];
  764. /**
  765. * @see _.intersectionWith
  766. */
  767. intersectionWith<T1, T2, T3>(array: List<T1> | null | undefined, values1: List<T2>, values2: List<T3>, comparator: Comparator2<T1, T1 | T2 | T3>): T1[];
  768. /**
  769. * @see _.intersectionWith
  770. */
  771. intersectionWith<T1, T2, T3, T4>(array: List<T1> | null | undefined, values1: List<T2>, values2: List<T3>, ...values: Array<List<T4> | Comparator2<T1, T1 | T2 | T3 | T4>>): T1[];
  772. /**
  773. * @see _.intersectionWith
  774. */
  775. intersectionWith<T>(array?: List<T> | null, ...values: Array<List<T> | Comparator2<T, never>>): T[];
  776. }
  777. interface Collection<T> {
  778. /**
  779. * @see _.intersectionWith
  780. */
  781. intersectionWith<T2>(values: List<T2>, comparator: Comparator2<T, T | T2>): Collection<T>;
  782. /**
  783. * @see _.intersectionWith
  784. */
  785. intersectionWith(...values: Array<List<unknown> | Comparator2<T, never>>): Collection<T>;
  786. }
  787. interface CollectionChain<T> {
  788. /**
  789. * @see _.intersectionWith
  790. */
  791. intersectionWith<T2>(values: List<T2>, comparator: Comparator2<T, T | T2>): CollectionChain<T>;
  792. /**
  793. * @see _.intersectionWith
  794. */
  795. intersectionWith(...values: Array<List<unknown> | Comparator2<T, never>>): CollectionChain<T>;
  796. }
  797. interface LoDashStatic {
  798. /**
  799. * Converts all elements in `array` into a string separated by `separator`.
  800. *
  801. * @param array The array to convert.
  802. * @param separator The element separator.
  803. * @returns Returns the joined string.
  804. */
  805. join(array: List<any> | null | undefined, separator?: string): string;
  806. }
  807. interface String {
  808. /**
  809. * @see _.join
  810. */
  811. join(separator?: string): string;
  812. }
  813. interface StringChain {
  814. /**
  815. * @see _.join
  816. */
  817. join(separator?: string): StringChain;
  818. }
  819. interface StringNullableChain {
  820. /**
  821. * @see _.join
  822. */
  823. join(separator?: string): StringChain;
  824. }
  825. interface Collection<T> {
  826. /**
  827. * @see _.join
  828. */
  829. join(separator?: string): string;
  830. }
  831. interface CollectionChain<T> {
  832. /**
  833. * @see _.join
  834. */
  835. join(separator?: string): StringChain;
  836. }
  837. interface LoDashStatic {
  838. /**
  839. * Gets the last element of array.
  840. *
  841. * @param array The array to query.
  842. * @return Returns the last element of array.
  843. */
  844. last<T>(array: List<T> | null | undefined): T | undefined;
  845. }
  846. interface Collection<T> {
  847. /**
  848. * @see _.last
  849. */
  850. last(): T | undefined;
  851. }
  852. interface CollectionChain<T> {
  853. /**
  854. * @see _.last
  855. */
  856. last(): ExpChain<T | undefined>;
  857. }
  858. interface String {
  859. /**
  860. * @see _.last
  861. */
  862. last(): string | undefined;
  863. }
  864. interface StringChain {
  865. /**
  866. * @see _.last
  867. */
  868. last(): StringNullableChain;
  869. }
  870. interface StringNullableChain {
  871. /**
  872. * @see _.last
  873. */
  874. last(): StringNullableChain;
  875. }
  876. interface LoDashStatic {
  877. /**
  878. * This method is like _.indexOf except that it iterates over elements of array from right to left.
  879. *
  880. * @param array The array to search.
  881. * @param value The value to search for.
  882. * @param fromIndex The index to search from or true to perform a binary search on a sorted array.
  883. * @return Returns the index of the matched value, else -1.
  884. */
  885. lastIndexOf<T>(array: List<T> | null | undefined, value: T, fromIndex?: true|number): number;
  886. }
  887. interface Collection<T> {
  888. /**
  889. * @see _.lastIndexOf
  890. */
  891. lastIndexOf(value: T, fromIndex?: true|number): number;
  892. }
  893. interface CollectionChain<T> {
  894. /**
  895. * @see _.lastIndexOf
  896. */
  897. lastIndexOf(value: T, fromIndex?: true|number): PrimitiveChain<number>;
  898. }
  899. interface LoDashStatic {
  900. /**
  901. * Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned.
  902. *
  903. * @param array array The array to query.
  904. * @param value The index of the element to return.
  905. * @return Returns the nth element of `array`.
  906. */
  907. nth<T>(array: List<T> | null | undefined, n?: number): T | undefined;
  908. }
  909. interface Collection<T> {
  910. /**
  911. * @see _.nth
  912. */
  913. nth(n?: number): T | undefined;
  914. }
  915. interface CollectionChain<T> {
  916. /**
  917. * @see _.nth
  918. */
  919. nth(n?: number): ExpChain<T | undefined>;
  920. }
  921. interface LoDashStatic {
  922. /**
  923. * Removes all provided values from array using SameValueZero for equality comparisons.
  924. *
  925. * Note: Unlike _.without, this method mutates array.
  926. *
  927. * @param array The array to modify.
  928. * @param values The values to remove.
  929. * @return Returns array.
  930. */
  931. pull<T>(array: T[], ...values: T[]): T[];
  932. /**
  933. * @see _.pull
  934. */
  935. pull<TList extends MutableList<any>>(array: RejectReadonly<TList>, ...values: TList[0][]): TList;
  936. }
  937. interface Collection<T> {
  938. /**
  939. * @see _.pull
  940. */
  941. pull(...values: T[]): Collection<T>;
  942. }
  943. interface CollectionChain<T> {
  944. /**
  945. * @see _.pull
  946. */
  947. pull(...values: T[]): CollectionChain<T>;
  948. }
  949. interface LoDashStatic {
  950. /**
  951. * This method is like `_.pull` except that it accepts an array of values to remove.
  952. *
  953. * **Note:** Unlike `_.difference`, this method mutates `array`.
  954. *
  955. * @category Array
  956. * @param array The array to modify.
  957. * @param values The values to remove.
  958. * @returns Returns `array`.
  959. * @example
  960. *
  961. * var array = [1, 2, 3, 1, 2, 3];
  962. *
  963. * _.pull(array, [2, 3]);
  964. * console.log(array);
  965. * // => [1, 1]
  966. */
  967. pullAll<T>(array: T[], values?: List<T>): T[];
  968. /**
  969. * @see _.pullAll
  970. */
  971. pullAll<TList extends MutableList<any>>(array: RejectReadonly<TList>, values?: List<TList[0]>): TList;
  972. }
  973. interface Collection<T> {
  974. /**
  975. * @see _.pullAll
  976. */
  977. pullAll(values?: List<T>): Collection<T>;
  978. }
  979. interface CollectionChain<T> {
  980. /**
  981. * @see _.pullAll
  982. */
  983. pullAll(values?: List<T>): CollectionChain<T>;
  984. }
  985. interface LoDashStatic {
  986. /**
  987. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  988. * invoked for each element of `array` and `values` to to generate the criterion
  989. * by which uniqueness is computed. The iteratee is invoked with one argument: (value).
  990. *
  991. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  992. *
  993. * @category Array
  994. * @param array The array to modify.
  995. * @param values The values to remove.
  996. * @param [iteratee=_.identity] The iteratee invoked per element.
  997. * @returns Returns `array`.
  998. * @example
  999. *
  1000. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  1001. *
  1002. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  1003. * console.log(array);
  1004. * // => [{ 'x': 2 }]
  1005. */
  1006. pullAllBy<T>(array: T[], values?: List<T>, iteratee?: ValueIteratee<T>): T[];
  1007. /**
  1008. * @see _.pullAllBy
  1009. */
  1010. pullAllBy<TList extends MutableList<any>>(array: RejectReadonly<TList>, values?: List<TList[0]>, iteratee?: ValueIteratee<TList[0]>): TList;
  1011. /**
  1012. * @see _.pullAllBy
  1013. */
  1014. pullAllBy<T1, T2>(array: T1[], values: List<T2>, iteratee: ValueIteratee<T1 | T2>): T1[];
  1015. /**
  1016. * @see _.pullAllBy
  1017. */
  1018. pullAllBy<T1List extends MutableList<any>, T2>(array: RejectReadonly<T1List>, values: List<T2>, iteratee: ValueIteratee<T1List[0] | T2>): T1List;
  1019. }
  1020. interface Collection<T> {
  1021. /**
  1022. * @see _.pullAllBy
  1023. */
  1024. pullAllBy<T2>(values?: List<T2>, iteratee?: ValueIteratee<T | T2>): Collection<T>;
  1025. }
  1026. interface CollectionChain<T> {
  1027. /**
  1028. * @see _.pullAllBy
  1029. */
  1030. pullAllBy<T2>(values?: List<T2>, iteratee?: ValueIteratee<T | T2>): CollectionChain<T>;
  1031. }
  1032. interface LoDashStatic {
  1033. /**
  1034. * This method is like `_.pullAll` except that it accepts `comparator` which is
  1035. * invoked to compare elements of array to values. The comparator is invoked with
  1036. * two arguments: (arrVal, othVal).
  1037. *
  1038. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  1039. *
  1040. * @category Array
  1041. * @param array The array to modify.
  1042. * @param values The values to remove.
  1043. * @param [iteratee=_.identity] The iteratee invoked per element.
  1044. * @returns Returns `array`.
  1045. * @example
  1046. *
  1047. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  1048. *
  1049. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  1050. * console.log(array);
  1051. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  1052. */
  1053. pullAllWith<T>(array: T[], values?: List<T>, comparator?: Comparator<T>): T[];
  1054. /**
  1055. * @see _.pullAllWith
  1056. */
  1057. pullAllWith<TList extends MutableList<any>>(array: RejectReadonly<TList>, values?: List<TList[0]>, comparator?: Comparator<TList[0]>): TList;
  1058. /**
  1059. * @see _.pullAllWith
  1060. */
  1061. pullAllWith<T1, T2>(array: T1[], values: List<T2>, comparator: Comparator2<T1, T2>): T1[];
  1062. /**
  1063. * @see _.pullAllWith
  1064. */
  1065. pullAllWith<T1List extends MutableList<any>, T2>(array: RejectReadonly<T1List>, values: List<T2>, comparator: Comparator2<T1List[0], T2>): T1List;
  1066. }
  1067. interface Collection<T> {
  1068. /**
  1069. * @see _.pullAllWith
  1070. */
  1071. pullAllWith<T2>(values?: List<T2>, comparator?: Comparator2<T, T2>): Collection<T>;
  1072. }
  1073. interface CollectionChain<T> {
  1074. /**
  1075. * @see _.pullAllWith
  1076. */
  1077. pullAllWith<T2>(values?: List<T2>, comparator?: Comparator2<T, T2>): CollectionChain<T>;
  1078. }
  1079. interface LoDashStatic {
  1080. /**
  1081. * Removes elements from array corresponding to the given indexes and returns an array of the removed elements.
  1082. * Indexes may be specified as an array of indexes or as individual arguments.
  1083. *
  1084. * Note: Unlike _.at, this method mutates array.
  1085. *
  1086. * @param array The array to modify.
  1087. * @param indexes The indexes of elements to remove, specified as individual indexes or arrays of indexes.
  1088. * @return Returns the new array of removed elements.
  1089. */
  1090. pullAt<T>(array: T[], ...indexes: Array<Many<number>>): T[];
  1091. /**
  1092. * @see _.pullAt
  1093. */
  1094. pullAt<TList extends MutableList<any>>(array: RejectReadonly<TList>, ...indexes: Array<Many<number>>): TList;
  1095. }
  1096. interface Collection<T> {
  1097. /**
  1098. * @see _.pullAt
  1099. */
  1100. pullAt(...indexes: Array<Many<number>>): Collection<T>;
  1101. }
  1102. interface CollectionChain<T> {
  1103. /**
  1104. * @see _.pullAt
  1105. */
  1106. pullAt(...indexes: Array<Many<number>>): CollectionChain<T>;
  1107. }
  1108. interface LoDashStatic {
  1109. /**
  1110. * Removes all elements from array that predicate returns truthy for and returns an array of the removed
  1111. * elements. The predicate is invoked with three arguments: (value, index, array).
  1112. *
  1113. * Note: Unlike _.filter, this method mutates array.
  1114. *
  1115. * @param array The array to modify.
  1116. * @param predicate The function invoked per iteration.
  1117. * @return Returns the new array of removed elements.
  1118. */
  1119. remove<TList extends MutableList<any>>(array: RejectReadonly<TList>, predicate?: ListIteratee<TList[0]>): TList[0][];
  1120. }
  1121. interface Collection<T> {
  1122. /**
  1123. * @see _.remove
  1124. */
  1125. remove(predicate?: ListIteratee<T>): Collection<T>;
  1126. }
  1127. interface CollectionChain<T> {
  1128. /**
  1129. * @see _.remove
  1130. */
  1131. remove(predicate?: ListIteratee<T>): CollectionChain<T>;
  1132. }
  1133. interface LoDashStatic {
  1134. /**
  1135. * Reverses `array` so that the first element becomes the last, the second
  1136. * element becomes the second to last, and so on.
  1137. *
  1138. * **Note:** This method mutates `array` and is based on
  1139. * [`Array#reverse`](https://mdn.io/Array/reverse).
  1140. *
  1141. * @category Array
  1142. * @returns Returns `array`.
  1143. * @example
  1144. *
  1145. * var array = [1, 2, 3];
  1146. *
  1147. * _.reverse(array);
  1148. * // => [3, 2, 1]
  1149. *
  1150. * console.log(array);
  1151. * // => [3, 2, 1]
  1152. */
  1153. reverse<TList extends MutableList<any>>(array: RejectReadonly<TList>): TList;
  1154. }
  1155. interface LoDashStatic {
  1156. /**
  1157. * Creates a slice of array from start up to, but not including, end.
  1158. *
  1159. * @param array The array to slice.
  1160. * @param start The start position.
  1161. * @param end The end position.
  1162. * @return Returns the slice of array.
  1163. */
  1164. slice<T>(array: List<T> | null | undefined, start?: number, end?: number): T[];
  1165. }
  1166. interface Collection<T> {
  1167. /**
  1168. * @see _.slice
  1169. */
  1170. slice(start?: number, end?: number): Collection<T>;
  1171. }
  1172. interface CollectionChain<T> {
  1173. /**
  1174. * @see _.slice
  1175. */
  1176. slice(start?: number, end?: number): CollectionChain<T>;
  1177. }
  1178. interface LoDashStatic {
  1179. /**
  1180. * Uses a binary search to determine the lowest index at which `value` should
  1181. * be inserted into `array` in order to maintain its sort order.
  1182. *
  1183. * @category Array
  1184. * @param array The sorted array to inspect.
  1185. * @param value The value to evaluate.
  1186. * @returns Returns the index at which `value` should be inserted into `array`.
  1187. * @example
  1188. *
  1189. * _.sortedIndex([30, 50], 40);
  1190. * // => 1
  1191. *
  1192. * _.sortedIndex([4, 5], 4);
  1193. * // => 0
  1194. */
  1195. sortedIndex<T>(array: List<T> | null | undefined, value: T): number;
  1196. }
  1197. interface Collection<T> {
  1198. /**
  1199. * @see _.sortedIndex
  1200. */
  1201. sortedIndex(value: T): number;
  1202. }
  1203. interface CollectionChain<T> {
  1204. /**
  1205. * @see _.sortedIndex
  1206. */
  1207. sortedIndex(value: T): PrimitiveChain<number>;
  1208. }
  1209. interface LoDashStatic {
  1210. /**
  1211. * Uses a binary search to determine the lowest index at which `value` should
  1212. * be inserted into `array` in order to maintain its sort order.
  1213. *
  1214. * @category Array
  1215. * @param array The sorted array to inspect.
  1216. * @param value The value to evaluate.
  1217. * @returns Returns the index at which `value` should be inserted into `array`.
  1218. * @example
  1219. *
  1220. * _.sortedIndex([30, 50], 40);
  1221. * // => 1
  1222. *
  1223. * _.sortedIndex([4, 5], 4);
  1224. * // => 0
  1225. */
  1226. sortedIndex<T>(array: List<T> | null | undefined, value: T): number;
  1227. }
  1228. interface Collection<T> {
  1229. /**
  1230. * @see _.sortedIndex
  1231. */
  1232. sortedIndex(value: T): number;
  1233. }
  1234. interface CollectionChain<T> {
  1235. /**
  1236. * @see _.sortedIndex
  1237. */
  1238. sortedIndex(value: T): PrimitiveChain<number>;
  1239. }
  1240. interface LoDashStatic {
  1241. /**
  1242. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  1243. * which is invoked for `value` and each element of `array` to compute their
  1244. * sort ranking. The iteratee is invoked with one argument: (value).
  1245. *
  1246. * @category Array
  1247. * @param array The sorted array to inspect.
  1248. * @param value The value to evaluate.
  1249. * @param [iteratee=_.identity] The iteratee invoked per element.
  1250. * @returns Returns the index at which `value` should be inserted into `array`.
  1251. * @example
  1252. *
  1253. * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 };
  1254. *
  1255. * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict));
  1256. * // => 1
  1257. *
  1258. * // using the `_.property` iteratee shorthand
  1259. * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');
  1260. * // => 0
  1261. */
  1262. sortedIndexBy<T>(array: List<T> | null | undefined, value: T, iteratee?: ValueIteratee<T>): number;
  1263. }
  1264. interface Collection<T> {
  1265. /**
  1266. * @see _.sortedIndexBy
  1267. */
  1268. sortedIndexBy(value: T, iteratee?: ValueIteratee<T>): number;
  1269. }
  1270. interface CollectionChain<T> {
  1271. /**
  1272. * @see _.sortedIndexBy
  1273. */
  1274. sortedIndexBy(value: T, iteratee?: ValueIteratee<T>): PrimitiveChain<number>;
  1275. }
  1276. interface LoDashStatic {
  1277. /**
  1278. * This method is like `_.indexOf` except that it performs a binary
  1279. * search on a sorted `array`.
  1280. *
  1281. * @category Array
  1282. * @param array The array to search.
  1283. * @param value The value to search for.
  1284. * @returns Returns the index of the matched value, else `-1`.
  1285. * @example
  1286. *
  1287. * _.sortedIndexOf([1, 1, 2, 2], 2);
  1288. * // => 2
  1289. */
  1290. sortedIndexOf<T>(array: List<T> | null | undefined, value: T): number;
  1291. }
  1292. interface Collection<T> {
  1293. /**
  1294. * @see _.sortedIndexOf
  1295. */
  1296. sortedIndexOf(value: T): number;
  1297. }
  1298. interface CollectionChain<T> {
  1299. /**
  1300. * @see _.sortedIndexOf
  1301. */
  1302. sortedIndexOf(value: T): PrimitiveChain<number>;
  1303. }
  1304. interface LoDashStatic {
  1305. /**
  1306. * This method is like `_.sortedIndex` except that it returns the highest
  1307. * index at which `value` should be inserted into `array` in order to
  1308. * maintain its sort order.
  1309. *
  1310. * @category Array
  1311. * @param array The sorted array to inspect.
  1312. * @param value The value to evaluate.
  1313. * @returns Returns the index at which `value` should be inserted into `array`.
  1314. * @example
  1315. *
  1316. * _.sortedLastIndex([4, 5], 4);
  1317. * // => 1
  1318. */
  1319. sortedLastIndex<T>(array: List<T> | null | undefined, value: T): number;
  1320. }
  1321. interface Collection<T> {
  1322. /**
  1323. * @see _.sortedLastIndex
  1324. */
  1325. sortedLastIndex(value: T): number;
  1326. }
  1327. interface CollectionChain<T> {
  1328. /**
  1329. * @see _.sortedLastIndex
  1330. */
  1331. sortedLastIndex(value: T): PrimitiveChain<number>;
  1332. }
  1333. interface LoDashStatic {
  1334. /**
  1335. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  1336. * which is invoked for `value` and each element of `array` to compute their
  1337. * sort ranking. The iteratee is invoked with one argument: (value).
  1338. *
  1339. * @category Array
  1340. * @param array The sorted array to inspect.
  1341. * @param value The value to evaluate.
  1342. * @param [iteratee=_.identity] The iteratee invoked per element.
  1343. * @returns Returns the index at which `value` should be inserted into `array`.
  1344. * @example
  1345. *
  1346. * // using the `_.property` iteratee shorthand
  1347. * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');
  1348. * // => 1
  1349. */
  1350. sortedLastIndexBy<T>(array: List<T> | null | undefined, value: T, iteratee: ValueIteratee<T>): number;
  1351. }
  1352. interface Collection<T> {
  1353. /**
  1354. * @see _.sortedLastIndexBy
  1355. */
  1356. sortedLastIndexBy(value: T, iteratee: ValueIteratee<T>): number;
  1357. }
  1358. interface CollectionChain<T> {
  1359. /**
  1360. * @see _.sortedLastIndexBy
  1361. */
  1362. sortedLastIndexBy(value: T, iteratee: ValueIteratee<T>): PrimitiveChain<number>;
  1363. }
  1364. interface LoDashStatic {
  1365. /**
  1366. * This method is like `_.lastIndexOf` except that it performs a binary
  1367. * search on a sorted `array`.
  1368. *
  1369. * @category Array
  1370. * @param array The array to search.
  1371. * @param value The value to search for.
  1372. * @returns Returns the index of the matched value, else `-1`.
  1373. * @example
  1374. *
  1375. * _.sortedLastIndexOf([1, 1, 2, 2], 2);
  1376. * // => 3
  1377. */
  1378. sortedLastIndexOf<T>(array: List<T> | null | undefined, value: T): number;
  1379. }
  1380. interface Collection<T> {
  1381. /**
  1382. * @see _.sortedLastIndexOf
  1383. */
  1384. sortedLastIndexOf(value: T): number;
  1385. }
  1386. interface CollectionChain<T> {
  1387. /**
  1388. * @see _.sortedLastIndexOf
  1389. */
  1390. sortedLastIndexOf(value: T): PrimitiveChain<number>;
  1391. }
  1392. interface LoDashStatic {
  1393. /**
  1394. * This method is like `_.uniq` except that it's designed and optimized
  1395. * for sorted arrays.
  1396. *
  1397. * @category Array
  1398. * @param array The array to inspect.
  1399. * @returns Returns the new duplicate free array.
  1400. * @example
  1401. *
  1402. * _.sortedUniq([1, 1, 2]);
  1403. * // => [1, 2]
  1404. */
  1405. sortedUniq<T>(array: List<T> | null | undefined): T[];
  1406. }
  1407. interface Collection<T> {
  1408. /**
  1409. * @see _.sortedUniq
  1410. */
  1411. sortedUniq(): Collection<T>;
  1412. }
  1413. interface CollectionChain<T> {
  1414. /**
  1415. * @see _.sortedUniq
  1416. */
  1417. sortedUniq(): CollectionChain<T>;
  1418. }
  1419. interface LoDashStatic {
  1420. /**
  1421. * This method is like `_.uniqBy` except that it's designed and optimized
  1422. * for sorted arrays.
  1423. *
  1424. * @category Array
  1425. * @param array The array to inspect.
  1426. * @param [iteratee] The iteratee invoked per element.
  1427. * @returns Returns the new duplicate free array.
  1428. * @example
  1429. *
  1430. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  1431. * // => [1.1, 2.3]
  1432. */
  1433. sortedUniqBy<T>(array: List<T> | null | undefined, iteratee: ValueIteratee<T>): T[];
  1434. }
  1435. interface Collection<T> {
  1436. /**
  1437. * @see _.sortedUniqBy
  1438. */
  1439. sortedUniqBy(iteratee: ValueIteratee<T>): Collection<T>;
  1440. }
  1441. interface CollectionChain<T> {
  1442. /**
  1443. * @see _.sortedUniqBy
  1444. */
  1445. sortedUniqBy(iteratee: ValueIteratee<T>): CollectionChain<T>;
  1446. }
  1447. interface LoDashStatic {
  1448. /**
  1449. * Gets all but the first element of array.
  1450. *
  1451. * @param array The array to query.
  1452. * @return Returns the slice of array.
  1453. */
  1454. tail<T extends unknown[]>(array: readonly [unknown, ...T]): T;
  1455. tail<T>(array: List<T> | null | undefined): T[];
  1456. }
  1457. interface Collection<T> {
  1458. /**
  1459. * @see _.tail
  1460. */
  1461. tail(): Collection<T>;
  1462. }
  1463. interface CollectionChain<T> {
  1464. /**
  1465. * @see _.tail
  1466. */
  1467. tail(): CollectionChain<T>;
  1468. }
  1469. interface LoDashStatic {
  1470. /**
  1471. * Creates a slice of array with n elements taken from the beginning.
  1472. *
  1473. * @param array The array to query.
  1474. * @param n The number of elements to take.
  1475. * @return Returns the slice of array.
  1476. */
  1477. take<T>(array: List<T> | null | undefined, n?: number): T[];
  1478. }
  1479. interface Collection<T> {
  1480. /**
  1481. * @see _.take
  1482. */
  1483. take(n?: number): Collection<T>;
  1484. }
  1485. interface CollectionChain<T> {
  1486. /**
  1487. * @see _.take
  1488. */
  1489. take(n?: number): CollectionChain<T>;
  1490. }
  1491. interface LoDashStatic {
  1492. /**
  1493. * Creates a slice of array with n elements taken from the end.
  1494. *
  1495. * @param array The array to query.
  1496. * @param n The number of elements to take.
  1497. * @return Returns the slice of array.
  1498. */
  1499. takeRight<T>(array: List<T> | null | undefined, n?: number): T[];
  1500. }
  1501. interface Collection<T> {
  1502. /**
  1503. * @see _.takeRight
  1504. */
  1505. takeRight(n?: number): Collection<T>;
  1506. }
  1507. interface CollectionChain<T> {
  1508. /**
  1509. * @see _.takeRight
  1510. */
  1511. takeRight(n?: number): CollectionChain<T>;
  1512. }
  1513. interface LoDashStatic {
  1514. /**
  1515. * Creates a slice of array with elements taken from the end. Elements are taken until predicate returns
  1516. * falsey. The predicate is invoked with three arguments: (value, index, array).
  1517. *
  1518. * @param array The array to query.
  1519. * @param predicate The function invoked per iteration.
  1520. * @return Returns the slice of array.
  1521. */
  1522. takeRightWhile<T>(array: List<T> | null | undefined, predicate?: ListIteratee<T>): T[];
  1523. }
  1524. interface Collection<T> {
  1525. /**
  1526. * @see _.takeRightWhile
  1527. */
  1528. takeRightWhile(predicate?: ListIteratee<T>): Collection<T>;
  1529. }
  1530. interface CollectionChain<T> {
  1531. /**
  1532. * @see _.takeRightWhile
  1533. */
  1534. takeRightWhile(predicate?: ListIteratee<T>): CollectionChain<T>;
  1535. }
  1536. interface LoDashStatic {
  1537. /**
  1538. * Creates a slice of array with elements taken from the beginning. Elements are taken until predicate returns
  1539. * falsey. The predicate is invoked with three arguments: (value, index, array).
  1540. *
  1541. * @param array The array to query.
  1542. * @param predicate The function invoked per iteration.
  1543. * @return Returns the slice of array.
  1544. */
  1545. takeWhile<T>(array: List<T> | null | undefined, predicate?: ListIteratee<T>): T[];
  1546. }
  1547. interface Collection<T> {
  1548. /**
  1549. * @see _.takeWhile
  1550. */
  1551. takeWhile(predicate?: ListIteratee<T>): Collection<T>;
  1552. }
  1553. interface CollectionChain<T> {
  1554. /**
  1555. * @see _.takeWhile
  1556. */
  1557. takeWhile(predicate?: ListIteratee<T>): CollectionChain<T>;
  1558. }
  1559. interface LoDashStatic {
  1560. /**
  1561. * Creates an array of unique values, in order, from all of the provided arrays using SameValueZero for
  1562. * equality comparisons.
  1563. *
  1564. * @param arrays The arrays to inspect.
  1565. * @return Returns the new array of combined values.
  1566. */
  1567. union<T>(...arrays: Array<List<T> | null | undefined>): T[];
  1568. }
  1569. interface Collection<T> {
  1570. /**
  1571. * @see _.union
  1572. */
  1573. union(...arrays: Array<List<T> | null | undefined>): Collection<T>;
  1574. }
  1575. interface CollectionChain<T> {
  1576. /**
  1577. * @see _.union
  1578. */
  1579. union(...arrays: Array<List<T> | null | undefined>): CollectionChain<T>;
  1580. }
  1581. interface LoDashStatic {
  1582. /**
  1583. * This method is like `_.union` except that it accepts `iteratee` which is
  1584. * invoked for each element of each `arrays` to generate the criterion by which
  1585. * uniqueness is computed. The iteratee is invoked with one argument: (value).
  1586. *
  1587. * @param arrays The arrays to inspect.
  1588. * @param iteratee The iteratee invoked per element.
  1589. * @return Returns the new array of combined values.
  1590. */
  1591. unionBy<T>(arrays: List<T> | null | undefined, iteratee?: ValueIteratee<T>): T[];
  1592. /**
  1593. * @see _.unionBy
  1594. */
  1595. unionBy<T>(arrays1: List<T> | null | undefined, arrays2: List<T> | null | undefined, iteratee?: ValueIteratee<T>): T[];
  1596. /**
  1597. * @see _.unionBy
  1598. */
  1599. unionBy<T>(arrays1: List<T> | null | undefined, arrays2: List<T> | null | undefined, arrays3: List<T> | null | undefined, iteratee?: ValueIteratee<T>): T[];
  1600. /**
  1601. * @see _.unionBy
  1602. */
  1603. unionBy<T>(arrays1: List<T> | null | undefined, arrays2: List<T> | null | undefined, arrays3: List<T> | null | undefined, arrays4: List<T> | null | undefined, iteratee?: ValueIteratee<T>): T[];
  1604. /**
  1605. * @see _.unionBy
  1606. */
  1607. unionBy<T>(arrays1: List<T> | null | undefined, arrays2: List<T> | null | undefined, arrays3: List<T> | null | undefined, arrays4: List<T> | null | undefined, arrays5: List<T> | null | undefined, ...iteratee: Array<ValueIteratee<T> | List<T> | null | undefined>): T[];
  1608. }
  1609. interface Collection<T> {
  1610. /**
  1611. * @see _.unionBy
  1612. */
  1613. unionBy(arrays2: List<T> | null | undefined, iteratee?: ValueIteratee<T>): Collection<T>;
  1614. /**
  1615. * @see _.unionBy
  1616. */
  1617. unionBy(...iteratee: Array<ValueIteratee<T> | List<T> | null | undefined>): Collection<T>;
  1618. }
  1619. interface CollectionChain<T> {
  1620. /**
  1621. * @see _.unionBy
  1622. */
  1623. unionBy(arrays2: List<T> | null | undefined, iteratee?: ValueIteratee<T>): CollectionChain<T>;
  1624. /**
  1625. * @see _.unionBy
  1626. */
  1627. unionBy(...iteratee: Array<ValueIteratee<T> | List<T> | null | undefined>): CollectionChain<T>;
  1628. }
  1629. interface LoDashStatic {
  1630. /**
  1631. * This method is like `_.union` except that it accepts `comparator` which
  1632. * is invoked to compare elements of `arrays`. The comparator is invoked
  1633. * with two arguments: (arrVal, othVal).
  1634. *
  1635. * @category Array
  1636. * @param [arrays] The arrays to inspect.
  1637. * @param [comparator] The comparator invoked per element.
  1638. * @returns Returns the new array of combined values.
  1639. * @example
  1640. *
  1641. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  1642. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  1643. *
  1644. * _.unionWith(objects, others, _.isEqual);
  1645. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  1646. */
  1647. unionWith<T>(arrays: List<T> | null | undefined, comparator?: Comparator<T>): T[];
  1648. /**
  1649. * @see _.unionWith
  1650. */
  1651. unionWith<T>(arrays: List<T> | null | undefined, arrays2: List<T> | null | undefined, comparator?: Comparator<T>): T[];
  1652. /**
  1653. * @see _.unionWith
  1654. */
  1655. unionWith<T>(arrays: List<T> | null | undefined, arrays2: List<T> | null | undefined, arrays3: List<T> | null | undefined, ...comparator: Array<Comparator<T> | List<T> | null | undefined>): T[];
  1656. }
  1657. interface Collection<T> {
  1658. /**
  1659. * @see _.unionWith
  1660. */
  1661. unionWith(arrays2: List<T> | null | undefined, comparator?: Comparator<T>): Collection<T>;
  1662. /**
  1663. * @see _.unionWith
  1664. */
  1665. unionWith(...comparator: Array<Comparator<T> | List<T> | null | undefined>): Collection<T>;
  1666. }
  1667. interface CollectionChain<T> {
  1668. /**
  1669. * @see _.unionWith
  1670. */
  1671. unionWith(arrays2: List<T> | null | undefined, comparator?: Comparator<T>): CollectionChain<T>;
  1672. /**
  1673. * @see _.unionWith
  1674. */
  1675. unionWith(...comparator: Array<Comparator<T> | List<T> | null | undefined>): CollectionChain<T>;
  1676. }
  1677. interface LoDashStatic {
  1678. /**
  1679. * Creates a duplicate-free version of an array, using
  1680. * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
  1681. * for equality comparisons, in which only the first occurrence of each element
  1682. * is kept.
  1683. *
  1684. * @category Array
  1685. * @param array The array to inspect.
  1686. * @returns Returns the new duplicate free array.
  1687. * @example
  1688. *
  1689. * _.uniq([2, 1, 2]);
  1690. * // => [2, 1]
  1691. */
  1692. uniq<T>(array: List<T> | null | undefined): T[];
  1693. }
  1694. interface Collection<T> {
  1695. /**
  1696. * @see _.uniq
  1697. */
  1698. uniq(): Collection<T>;
  1699. }
  1700. interface CollectionChain<T> {
  1701. /**
  1702. * @see _.uniq
  1703. */
  1704. uniq(): CollectionChain<T>;
  1705. }
  1706. interface LoDashStatic {
  1707. /**
  1708. * This method is like `_.uniq` except that it accepts `iteratee` which is
  1709. * invoked for each element in `array` to generate the criterion by which
  1710. * uniqueness is computed. The iteratee is invoked with one argument: (value).
  1711. *
  1712. * @category Array
  1713. * @param array The array to inspect.
  1714. * @param [iteratee=_.identity] The iteratee invoked per element.
  1715. * @returns Returns the new duplicate free array.
  1716. * @example
  1717. *
  1718. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  1719. * // => [2.1, 1.2]
  1720. *
  1721. * // using the `_.property` iteratee shorthand
  1722. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  1723. * // => [{ 'x': 1 }, { 'x': 2 }]
  1724. */
  1725. uniqBy<T>(array: List<T> | null | undefined, iteratee: ValueIteratee<T>): T[];
  1726. }
  1727. interface Collection<T> {
  1728. /**
  1729. * @see _.uniqBy
  1730. */
  1731. uniqBy(iteratee: ValueIteratee<T>): Collection<T>;
  1732. }
  1733. interface CollectionChain<T> {
  1734. /**
  1735. * @see _.uniqBy
  1736. */
  1737. uniqBy(iteratee: ValueIteratee<T>): CollectionChain<T>;
  1738. }
  1739. interface LoDashStatic {
  1740. /**
  1741. * This method is like `_.uniq` except that it accepts `comparator` which
  1742. * is invoked to compare elements of `array`. The comparator is invoked with
  1743. * two arguments: (arrVal, othVal).
  1744. *
  1745. * @category Array
  1746. * @param array The array to inspect.
  1747. * @param [comparator] The comparator invoked per element.
  1748. * @returns Returns the new duplicate free array.
  1749. * @example
  1750. *
  1751. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  1752. *
  1753. * _.uniqWith(objects, _.isEqual);
  1754. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  1755. */
  1756. uniqWith<T>(array: List<T> | null | undefined, comparator?: Comparator<T>): T[];
  1757. }
  1758. interface Collection<T> {
  1759. /**
  1760. * @see _.uniqWith
  1761. */
  1762. uniqWith(comparator?: Comparator<T>): Collection<T>;
  1763. }
  1764. interface CollectionChain<T> {
  1765. /**
  1766. * @see _.uniqWith
  1767. */
  1768. uniqWith(comparator?: Comparator<T>): CollectionChain<T>;
  1769. }
  1770. interface LoDashStatic {
  1771. /**
  1772. * This method is like _.zip except that it accepts an array of grouped elements and creates an array
  1773. * regrouping the elements to their pre-zip configuration.
  1774. *
  1775. * @param array The array of grouped elements to process.
  1776. * @return Returns the new array of regrouped elements.
  1777. */
  1778. unzip<T>(array: T[][] | List<List<T>> | null | undefined): T[][];
  1779. }
  1780. interface Collection<T> {
  1781. /**
  1782. * @see _.unzip
  1783. */
  1784. unzip(): T extends List<infer U> ? Collection<U[]> : unknown;
  1785. }
  1786. interface CollectionChain<T> {
  1787. /**
  1788. * @see _.unzip
  1789. */
  1790. unzip(): T extends List<infer U> ? CollectionChain<U[]> : unknown;
  1791. }
  1792. interface LoDashStatic {
  1793. /**
  1794. * This method is like _.unzip except that it accepts an iteratee to specify how regrouped values should be
  1795. * combined. The iteratee is invoked with four arguments: (accumulator, value, index, group).
  1796. *
  1797. * @param array The array of grouped elements to process.
  1798. * @param iteratee The function to combine regrouped values.
  1799. * @return Returns the new array of regrouped elements.
  1800. */
  1801. unzipWith<T, TResult>(array: List<List<T>> | null | undefined, iteratee: (...values: T[]) => TResult): TResult[];
  1802. /**
  1803. * @see _.unzipWith
  1804. */
  1805. unzipWith<T>(array: List<List<T>> | null | undefined): T[][];
  1806. }
  1807. interface Collection<T> {
  1808. /**
  1809. * @see _.unzipWith
  1810. */
  1811. unzipWith<TResult>(iteratee: (...values: Array<T extends List<infer U> ? U : unknown>) => TResult): Collection<TResult>;
  1812. /**
  1813. * @see _.unzipWith
  1814. */
  1815. unzipWith(): T extends List<infer U> ? Collection<U[]> : unknown;
  1816. }
  1817. interface CollectionChain<T> {
  1818. /**
  1819. * @see _.unzipWith
  1820. */
  1821. unzipWith<TResult>(iteratee: (...values: Array<T extends List<infer U> ? U : unknown>) => TResult): CollectionChain<TResult>;
  1822. /**
  1823. * @see _.unzipWith
  1824. */
  1825. unzipWith(): T extends List<infer U> ? CollectionChain<U[]> : unknown;
  1826. }
  1827. interface LoDashStatic {
  1828. /**
  1829. * Creates an array excluding all provided values using SameValueZero for equality comparisons.
  1830. *
  1831. * @param array The array to filter.
  1832. * @param values The values to exclude.
  1833. * @return Returns the new array of filtered values.
  1834. */
  1835. without<T>(array: List<T> | null | undefined, ...values: T[]): T[];
  1836. }
  1837. interface Collection<T> {
  1838. /**
  1839. * @see _.without
  1840. */
  1841. without(...values: T[]): Collection<T>;
  1842. }
  1843. interface CollectionChain<T> {
  1844. /**
  1845. * @see _.without
  1846. */
  1847. without(...values: T[]): CollectionChain<T>;
  1848. }
  1849. interface LoDashStatic {
  1850. /**
  1851. * Creates an array of unique values that is the symmetric difference of the provided arrays.
  1852. *
  1853. * @param arrays The arrays to inspect.
  1854. * @return Returns the new array of values.
  1855. */
  1856. xor<T>(...arrays: Array<List<T> | null | undefined>): T[];
  1857. }
  1858. interface Collection<T> {
  1859. /**
  1860. * @see _.xor
  1861. */
  1862. xor(...arrays: Array<List<T> | null | undefined>): Collection<T>;
  1863. }
  1864. interface CollectionChain<T> {
  1865. /**
  1866. * @see _.xor
  1867. */
  1868. xor(...arrays: Array<List<T> | null | undefined>): CollectionChain<T>;
  1869. }
  1870. interface LoDashStatic {
  1871. /**
  1872. * This method is like `_.xor` except that it accepts `iteratee` which is
  1873. * invoked for each element of each `arrays` to generate the criterion by which
  1874. * uniqueness is computed. The iteratee is invoked with one argument: (value).
  1875. *
  1876. * @category Array
  1877. * @param [arrays] The arrays to inspect.
  1878. * @param [iteratee=_.identity] The iteratee invoked per element.
  1879. * @returns Returns the new array of values.
  1880. * @example
  1881. *
  1882. * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor);
  1883. * // => [1.2, 4.3]
  1884. *
  1885. * // using the `_.property` iteratee shorthand
  1886. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  1887. * // => [{ 'x': 2 }]
  1888. */
  1889. xorBy<T>(arrays: List<T> | null | undefined, iteratee?: ValueIteratee<T>): T[];
  1890. /**
  1891. * @see _.xorBy
  1892. */
  1893. xorBy<T>(arrays: List<T> | null | undefined, arrays2: List<T> | null | undefined, iteratee?: ValueIteratee<T>): T[];
  1894. /**
  1895. * @see _.xorBy
  1896. */
  1897. xorBy<T>(arrays: List<T> | null | undefined, arrays2: List<T> | null | undefined, arrays3: List<T> | null | undefined, ...iteratee: Array<ValueIteratee<T> | List<T> | null | undefined>): T[];
  1898. }
  1899. interface Collection<T> {
  1900. /**
  1901. * @see _.xorBy
  1902. */
  1903. xorBy(arrays2: List<T> | null | undefined, iteratee?: ValueIteratee<T>): Collection<T>;
  1904. /**
  1905. * @see _.xorBy
  1906. */
  1907. xorBy(...iteratee: Array<ValueIteratee<T> | List<T> | null | undefined>): Collection<T>;
  1908. }
  1909. interface CollectionChain<T> {
  1910. /**
  1911. * @see _.xorBy
  1912. */
  1913. xorBy(arrays2: List<T> | null | undefined, iteratee?: ValueIteratee<T>): CollectionChain<T>;
  1914. /**
  1915. * @see _.xorBy
  1916. */
  1917. xorBy(...iteratee: Array<ValueIteratee<T> | List<T> | null | undefined>): CollectionChain<T>;
  1918. }
  1919. interface LoDashStatic {
  1920. /**
  1921. * This method is like `_.xor` except that it accepts `comparator` which is
  1922. * invoked to compare elements of `arrays`. The comparator is invoked with
  1923. * two arguments: (arrVal, othVal).
  1924. *
  1925. * @category Array
  1926. * @param [arrays] The arrays to inspect.
  1927. * @param [comparator] The comparator invoked per element.
  1928. * @returns Returns the new array of values.
  1929. * @example
  1930. *
  1931. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  1932. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  1933. *
  1934. * _.xorWith(objects, others, _.isEqual);
  1935. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  1936. */
  1937. xorWith<T>(arrays: List<T> | null | undefined, comparator?: Comparator<T>): T[];
  1938. /**
  1939. * @see _.xorWith
  1940. */
  1941. xorWith<T>(arrays: List<T> | null | undefined, arrays2: List<T> | null | undefined, comparator?: Comparator<T>): T[];
  1942. /**
  1943. * @see _.xorWith
  1944. */
  1945. xorWith<T>(arrays: List<T> | null | undefined, arrays2: List<T> | null | undefined, arrays3: List<T> | null | undefined, ...comparator: Array<Comparator<T> | List<T> | null | undefined>): T[];
  1946. }
  1947. interface Collection<T> {
  1948. /**
  1949. * @see _.xorWith
  1950. */
  1951. xorWith(arrays2: List<T> | null | undefined, comparator?: Comparator<T>): Collection<T>;
  1952. /**
  1953. * @see _.xorWith
  1954. */
  1955. xorWith(...comparator: Array<Comparator<T> | List<T> | null | undefined>): Collection<T>;
  1956. }
  1957. interface CollectionChain<T> {
  1958. /**
  1959. * @see _.xorWith
  1960. */
  1961. xorWith(arrays2: List<T> | null | undefined, comparator?: Comparator<T>): CollectionChain<T>;
  1962. /**
  1963. * @see _.xorWith
  1964. */
  1965. xorWith(...comparator: Array<Comparator<T> | List<T> | null | undefined>): CollectionChain<T>;
  1966. }
  1967. interface LoDashStatic {
  1968. /**
  1969. * Creates an array of grouped elements, the first of which contains the first elements of the given arrays,
  1970. * the second of which contains the second elements of the given arrays, and so on.
  1971. *
  1972. * @param arrays The arrays to process.
  1973. * @return Returns the new array of grouped elements.
  1974. */
  1975. zip<T1, T2>(arrays1: List<T1>, arrays2: List<T2>): Array<[T1 | undefined, T2 | undefined]>;
  1976. /**
  1977. * @see _.zip
  1978. */
  1979. zip<T1, T2, T3>(arrays1: List<T1>, arrays2: List<T2>, arrays3: List<T3>): Array<[T1 | undefined, T2 | undefined, T3 | undefined]>;
  1980. /**
  1981. * @see _.zip
  1982. */
  1983. zip<T1, T2, T3, T4>(arrays1: List<T1>, arrays2: List<T2>, arrays3: List<T3>, arrays4: List<T4>): Array<[T1 | undefined, T2 | undefined, T3 | undefined, T4 | undefined]>;
  1984. /**
  1985. * @see _.zip
  1986. */
  1987. zip<T1, T2, T3, T4, T5>(arrays1: List<T1>, arrays2: List<T2>, arrays3: List<T3>, arrays4: List<T4>, arrays5: List<T5>): Array<[T1 | undefined, T2 | undefined, T3 | undefined, T4 | undefined, T5 | undefined]>;
  1988. /**
  1989. * @see _.zip
  1990. */
  1991. zip<T>(...arrays: Array<List<T> | null | undefined>): Array<Array<T | undefined>>;
  1992. }
  1993. interface Collection<T> {
  1994. /**
  1995. * @see _.zip
  1996. */
  1997. zip<T2>(arrays2: List<T2>): Collection<[T | undefined, T2 | undefined]>;
  1998. /**
  1999. * @see _.zip
  2000. */
  2001. zip(...arrays: Array<List<T> | null | undefined>): Collection<Array<T | undefined>>;
  2002. }
  2003. interface CollectionChain<T> {
  2004. /**
  2005. * @see _.zip
  2006. */
  2007. zip<T2>(arrays2: List<T2>): CollectionChain<[T | undefined, T2 | undefined]>;
  2008. /**
  2009. * @see _.zip
  2010. */
  2011. zip(...arrays: Array<List<T> | null | undefined>): CollectionChain<Array<T | undefined>>;
  2012. }
  2013. interface LoDashStatic {
  2014. /**
  2015. * This method is like _.fromPairs except that it accepts two arrays, one of property
  2016. * identifiers and one of corresponding values.
  2017. *
  2018. * @param props The property names.
  2019. * @param values The property values.
  2020. * @return Returns the new object.
  2021. */
  2022. zipObject<T>(props: List<PropertyName>, values: List<T>): Dictionary<T>;
  2023. /**
  2024. * @see _.zipObject
  2025. */
  2026. zipObject(props?: List<PropertyName>): Dictionary<undefined>;
  2027. }
  2028. interface Collection<T> {
  2029. /**
  2030. * @see _.zipObject
  2031. */
  2032. zipObject<U>(values: List<U>): Object<Dictionary<U>>;
  2033. /**
  2034. * @see _.zipObject
  2035. */
  2036. zipObject(): Object<Dictionary<undefined>>;
  2037. }
  2038. interface CollectionChain<T> {
  2039. /**
  2040. * @see _.zipObject
  2041. */
  2042. zipObject<U>(values: List<U>): ObjectChain<Dictionary<U>>;
  2043. /**
  2044. * @see _.zipObject
  2045. */
  2046. zipObject(): ObjectChain<Dictionary<undefined>>;
  2047. }
  2048. interface LoDashStatic {
  2049. /**
  2050. * This method is like _.zipObject except that it supports property paths.
  2051. *
  2052. * @param paths The property names.
  2053. * @param values The property values.
  2054. * @return Returns the new object.
  2055. */
  2056. zipObjectDeep(paths?: List<PropertyPath>, values?: List<any>): object;
  2057. }
  2058. interface Collection<T> {
  2059. /**
  2060. * @see _.zipObjectDeep
  2061. */
  2062. zipObjectDeep(values?: List<any>): Object<object>;
  2063. }
  2064. interface CollectionChain<T> {
  2065. /**
  2066. * @see _.zipObjectDeep
  2067. */
  2068. zipObjectDeep(values?: List<any>): ObjectChain<object>;
  2069. }
  2070. interface LoDashStatic {
  2071. /**
  2072. * This method is like _.zip except that it accepts an iteratee to specify how grouped values should be
  2073. * combined. The iteratee is invoked with four arguments: (accumulator, value, index,
  2074. * group).
  2075. * @param arrays The arrays to process.
  2076. * @param iteratee The function to combine grouped values.
  2077. * @return Returns the new array of grouped elements.
  2078. */
  2079. zipWith<T, TResult>(arrays: List<T>, iteratee: (value1: T) => TResult): TResult[];
  2080. /**
  2081. * @see _.zipWith
  2082. */
  2083. zipWith<T1, T2, TResult>(arrays1: List<T1>, arrays2: List<T2>, iteratee: (value1: T1, value2: T2) => TResult): TResult[];
  2084. /**
  2085. * @see _.zipWith
  2086. */
  2087. zipWith<T1, T2, T3, TResult>(arrays1: List<T1>, arrays2: List<T2>, arrays3: List<T3>, iteratee: (value1: T1, value2: T2, value3: T3) => TResult): TResult[];
  2088. /**
  2089. * @see _.zipWith
  2090. */
  2091. zipWith<T1, T2, T3, T4, TResult>(arrays1: List<T1>, arrays2: List<T2>, arrays3: List<T3>, arrays4: List<T4>, iteratee: (value1: T1, value2: T2, value3: T3, value4: T4) => TResult): TResult[];
  2092. /**
  2093. * @see _.zipWith
  2094. */
  2095. zipWith<T1, T2, T3, T4, T5, TResult>(arrays1: List<T1>, arrays2: List<T2>, arrays3: List<T3>, arrays4: List<T4>, arrays5: List<T5>, iteratee: (value1: T1, value2: T2, value3: T3, value4: T4, value5: T5) => TResult): TResult[];
  2096. /**
  2097. * @see _.zipWith
  2098. */
  2099. zipWith<T, TResult>(...iteratee: Array<((...group: T[]) => TResult) | List<T> | null | undefined>): TResult[];
  2100. }
  2101. interface Collection<T> {
  2102. /**
  2103. * @see _.zipWith
  2104. */
  2105. zipWith<T2, TResult>(arrays2: List<T2>, iteratee: (value1: T, value2: T2) => TResult): Collection<TResult>;
  2106. /**
  2107. * @see _.zipWith
  2108. */
  2109. zipWith<T2, T3, TResult>(arrays2: List<T2>, arrays3: List<T3>, iteratee: (value1: T, value2: T2, value3: T3) => TResult): Collection<TResult>;
  2110. /**
  2111. * @see _.zipWith
  2112. */
  2113. zipWith<TResult>(...iteratee: Array<((...group: T[]) => TResult) | List<T> | null | undefined>): Collection<TResult>;
  2114. }
  2115. interface CollectionChain<T> {
  2116. /**
  2117. * @see _.zipWith
  2118. */
  2119. zipWith<T2, TResult>(arrays2: List<T2>, iteratee: (value1: T, value2: T2) => TResult): CollectionChain<TResult>;
  2120. /**
  2121. * @see _.zipWith
  2122. */
  2123. zipWith<T2, T3, TResult>(arrays2: List<T2>, arrays3: List<T3>, iteratee: (value1: T, value2: T2, value3: T3) => TResult): CollectionChain<TResult>;
  2124. /**
  2125. * @see _.zipWith
  2126. */
  2127. zipWith<TResult>(...iteratee: Array<((...group: T[]) => TResult) | List<T> | null | undefined>): CollectionChain<TResult>;
  2128. }
  2129. }