256bc419981e642ad7196e15b159cee1e3a7cfea9feb1ba3c848142b3f35deb82dba556ac7c612673ee5641132895b9b179203217052d80604d6277624fcd5 66 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938
  1. import _ = require("../index");
  2. declare module "../index" {
  3. interface LoDashStatic {
  4. /**
  5. * Creates an object composed of keys generated from the results of running each element of collection through
  6. * iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The
  7. * iteratee is invoked with one argument: (value).
  8. *
  9. * @param collection The collection to iterate over.
  10. * @param iteratee The function invoked per iteration.
  11. * @return Returns the composed aggregate object.
  12. */
  13. countBy<T>(collection: List<T> | null | undefined, iteratee?: ValueIteratee<T>): Dictionary<number>;
  14. /**
  15. * @see _.countBy
  16. */
  17. countBy<T extends object>(collection: T | null | undefined, iteratee?: ValueIteratee<T[keyof T]>): Dictionary<number>;
  18. }
  19. interface Object<T> {
  20. /**
  21. * @see _.countBy
  22. */
  23. countBy(iteratee?: ValueIteratee<T[keyof T]>): Object<Dictionary<number>>;
  24. }
  25. interface String {
  26. /**
  27. * @see _.countBy
  28. */
  29. countBy(iteratee?: ValueIteratee<string>): Object<Dictionary<number>>;
  30. }
  31. interface Collection<T> {
  32. /**
  33. * @see _.countBy
  34. */
  35. countBy(iteratee?: ValueIteratee<T>): Object<Dictionary<number>>;
  36. }
  37. interface ObjectChain<T> {
  38. /**
  39. * @see _.countBy
  40. */
  41. countBy(iteratee?: ValueIteratee<T[keyof T]>): ObjectChain<Dictionary<number>>;
  42. }
  43. interface StringChain {
  44. /**
  45. * @see _.countBy
  46. */
  47. countBy(iteratee?: ValueIteratee<string>): ObjectChain<Dictionary<number>>;
  48. }
  49. interface StringNullableChain {
  50. /**
  51. * @see _.countBy
  52. */
  53. countBy(iteratee?: ValueIteratee<string>): ObjectChain<Dictionary<number>>;
  54. }
  55. interface CollectionChain<T> {
  56. /**
  57. * @see _.countBy
  58. */
  59. countBy(iteratee?: ValueIteratee<T>): ObjectChain<Dictionary<number>>;
  60. }
  61. interface LoDashStatic {
  62. /**
  63. * @see _.forEach
  64. */
  65. each: LoDashStatic['forEach'];
  66. }
  67. interface String {
  68. /**
  69. * @see _.each
  70. */
  71. each: String['forEach'];
  72. }
  73. interface Collection<T> {
  74. /**
  75. * @see _.each
  76. */
  77. each: Collection<T>['forEach'];
  78. }
  79. interface Object<T> {
  80. /**
  81. * @see _.each
  82. */
  83. each: Object<T>['forEach'];
  84. }
  85. interface StringChain {
  86. /**
  87. * @see _.each
  88. */
  89. each: StringChain['forEach'];
  90. }
  91. interface StringNullableChain {
  92. /**
  93. * @see _.each
  94. */
  95. each: StringNullableChain['forEach'];
  96. }
  97. interface CollectionChain<T> {
  98. /**
  99. * @see _.each
  100. */
  101. each: CollectionChain<T>['forEach'];
  102. }
  103. interface ObjectChain<T> {
  104. /**
  105. * @see _.each
  106. */
  107. each: ObjectChain<T>['forEach'];
  108. }
  109. interface LoDashStatic {
  110. /**
  111. * @see _.forEachRight
  112. */
  113. eachRight: LoDashStatic["forEachRight"];
  114. }
  115. interface String {
  116. /**
  117. * @see _.eachRight
  118. */
  119. eachRight: String['forEachRight'];
  120. }
  121. interface Collection<T> {
  122. /**
  123. * @see _.eachRight
  124. */
  125. eachRight: Collection<T>['forEachRight'];
  126. }
  127. interface Object<T> {
  128. /**
  129. * @see _.eachRight
  130. */
  131. eachRight: Object<T>['forEachRight'];
  132. }
  133. interface StringChain {
  134. /**
  135. * @see _.eachRight
  136. */
  137. eachRight: StringChain['forEachRight'];
  138. }
  139. interface StringNullableChain {
  140. /**
  141. * @see _.eachRight
  142. */
  143. eachRight: StringNullableChain['forEachRight'];
  144. }
  145. interface CollectionChain<T> {
  146. /**
  147. * @see _.eachRight
  148. */
  149. eachRight: CollectionChain<T>['forEachRight'];
  150. }
  151. interface ObjectChain<T> {
  152. /**
  153. * @see _.eachRight
  154. */
  155. eachRight: ObjectChain<T>['forEachRight'];
  156. }
  157. interface LoDashStatic {
  158. /**
  159. * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate
  160. * returns falsey. The predicate is invoked with three arguments: (value, index|key, collection).
  161. *
  162. * @param collection The collection to iterate over.
  163. * @param predicate The function invoked per iteration.
  164. * @return Returns true if all elements pass the predicate check, else false.
  165. */
  166. every<T>(collection: List<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>): boolean;
  167. /**
  168. * @see _.every
  169. */
  170. every<T extends object>(collection: T | null | undefined, predicate?: ObjectIterateeCustom<T, boolean>): boolean;
  171. }
  172. interface Collection<T> {
  173. /**
  174. * @see _.every
  175. */
  176. every(predicate?: ListIterateeCustom<T, boolean>): boolean;
  177. }
  178. interface Object<T> {
  179. /**
  180. * @see _.every
  181. */
  182. every(predicate?: ObjectIterateeCustom<T, boolean>): boolean;
  183. }
  184. interface CollectionChain<T> {
  185. /**
  186. * @see _.every
  187. */
  188. every(predicate?: ListIterateeCustom<T, boolean>): PrimitiveChain<boolean>;
  189. }
  190. interface ObjectChain<T> {
  191. /**
  192. * @see _.every
  193. */
  194. every(predicate?: ObjectIterateeCustom<T, boolean>): PrimitiveChain<boolean>;
  195. }
  196. interface LoDashStatic {
  197. /**
  198. * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The
  199. * predicate is invoked with three arguments: (value, index|key, collection).
  200. *
  201. * @param collection The collection to iterate over.
  202. * @param predicate The function invoked per iteration.
  203. * @return Returns the new filtered array.
  204. */
  205. filter(collection: string | null | undefined, predicate?: StringIterator<boolean>): string[];
  206. /**
  207. * @see _.filter
  208. */
  209. filter<T, S extends T>(collection: List<T> | null | undefined, predicate: ListIteratorTypeGuard<T, S>): S[];
  210. /**
  211. * @see _.filter
  212. */
  213. filter<T>(collection: List<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>): T[];
  214. /**
  215. * @see _.filter
  216. */
  217. filter<T extends object, S extends T[keyof T]>(collection: T | null | undefined, predicate: ObjectIteratorTypeGuard<T, S>): S[];
  218. /**
  219. * @see _.filter
  220. */
  221. filter<T extends object>(collection: T | null | undefined, predicate?: ObjectIterateeCustom<T, boolean>): Array<T[keyof T]>;
  222. }
  223. interface String {
  224. /**
  225. * @see _.filter
  226. */
  227. filter(predicate?: StringIterator<boolean>): Collection<string>;
  228. }
  229. interface Collection<T> {
  230. /**
  231. * @see _.filter
  232. */
  233. filter<S extends T>(predicate: ListIteratorTypeGuard<T, S>): Collection<S>;
  234. /**
  235. * @see _.filter
  236. */
  237. filter(predicate?: ListIterateeCustom<T, boolean>): Collection<T>;
  238. }
  239. interface Object<T> {
  240. /**
  241. * @see _.filter
  242. */
  243. filter<S extends T[keyof T]>(predicate: ObjectIteratorTypeGuard<T, S>): Collection<S>;
  244. /**
  245. * @see _.filter
  246. */
  247. filter(predicate?: ObjectIterateeCustom<T, boolean>): Collection<T[keyof T]>;
  248. }
  249. interface StringChain {
  250. /**
  251. * @see _.filter
  252. */
  253. filter(predicate?: StringIterator<boolean>): CollectionChain<string>;
  254. }
  255. interface StringNullableChain {
  256. /**
  257. * @see _.filter
  258. */
  259. filter(predicate?: StringIterator<boolean>): CollectionChain<string>;
  260. }
  261. interface CollectionChain<T> {
  262. /**
  263. * @see _.filter
  264. */
  265. filter<S extends T>(predicate: ListIteratorTypeGuard<T, S>): CollectionChain<S>;
  266. /**
  267. * @see _.filter
  268. */
  269. filter(predicate?: ListIterateeCustom<T, boolean>): CollectionChain<T>;
  270. }
  271. interface ObjectChain<T> {
  272. /**
  273. * @see _.filter
  274. */
  275. filter<S extends T[keyof T]>(predicate: ObjectIteratorTypeGuard<T, S>): CollectionChain<S>;
  276. /**
  277. * @see _.filter
  278. */
  279. filter(predicate?: ObjectIterateeCustom<T, boolean>): CollectionChain<T[keyof T]>;
  280. }
  281. interface LoDashStatic {
  282. /**
  283. * Iterates over elements of collection, returning the first element predicate returns truthy for.
  284. * The predicate is invoked with three arguments: (value, index|key, collection).
  285. *
  286. * @param collection The collection to search.
  287. * @param predicate The function invoked per iteration.
  288. * @param fromIndex The index to search from.
  289. * @return Returns the matched element, else undefined.
  290. */
  291. find<T, S extends T>(collection: List<T> | null | undefined, predicate: ListIteratorTypeGuard<T, S>, fromIndex?: number): S|undefined;
  292. /**
  293. * @see _.find
  294. */
  295. find<T>(collection: List<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): T|undefined;
  296. /**
  297. * @see _.find
  298. */
  299. find<T extends object, S extends T[keyof T]>(collection: T | null | undefined, predicate: ObjectIteratorTypeGuard<T, S>, fromIndex?: number): S|undefined;
  300. /**
  301. * @see _.find
  302. */
  303. find<T extends object>(collection: T | null | undefined, predicate?: ObjectIterateeCustom<T, boolean>, fromIndex?: number): T[keyof T]|undefined;
  304. }
  305. interface Collection<T> {
  306. /**
  307. * @see _.find
  308. */
  309. find<S extends T>(predicate: ListIteratorTypeGuard<T, S>, fromIndex?: number): S|undefined;
  310. /**
  311. * @see _.find
  312. */
  313. find(predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): T|undefined;
  314. }
  315. interface Object<T> {
  316. /**
  317. * @see _.find
  318. */
  319. find< S extends T[keyof T]>(predicate: ObjectIteratorTypeGuard<T, S>, fromIndex?: number): S|undefined;
  320. /**
  321. * @see _.find
  322. */
  323. find(predicate?: ObjectIterateeCustom<T, boolean>, fromIndex?: number): T[keyof T]|undefined;
  324. }
  325. interface CollectionChain<T> {
  326. /**
  327. * @see _.find
  328. */
  329. find< S extends T>(predicate: ListIteratorTypeGuard<T, S>, fromIndex?: number): ExpChain<S|undefined>;
  330. /**
  331. * @see _.find
  332. */
  333. find(predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): ExpChain<T|undefined>;
  334. }
  335. interface ObjectChain<T> {
  336. /**
  337. * @see _.find
  338. */
  339. find< S extends T[keyof T]>(predicate: ObjectIteratorTypeGuard<T, S>, fromIndex?: number): ExpChain<S|undefined>;
  340. /**
  341. * @see _.find
  342. */
  343. find(predicate?: ObjectIterateeCustom<T, boolean>, fromIndex?: number): ExpChain<T[keyof T]|undefined>;
  344. }
  345. interface LoDashStatic {
  346. /**
  347. * This method is like _.find except that it iterates over elements of a collection from
  348. * right to left.
  349. * @param collection Searches for a value in this list.
  350. * @param predicate The function called per iteration.
  351. * @param fromIndex The index to search from.
  352. * @return The found element, else undefined.
  353. */
  354. findLast<T, S extends T>(collection: List<T> | null | undefined, predicate: ListIteratorTypeGuard<T, S>, fromIndex?: number): S|undefined;
  355. /**
  356. * @see _.findLast
  357. */
  358. findLast<T>(collection: List<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): T|undefined;
  359. /**
  360. * @see _.findLast
  361. */
  362. findLast<T extends object, S extends T[keyof T]>(collection: T | null | undefined, predicate: ObjectIteratorTypeGuard<T, S>, fromIndex?: number): S|undefined;
  363. /**
  364. * @see _.findLast
  365. */
  366. findLast<T extends object>(collection: T | null | undefined, predicate?: ObjectIterateeCustom<T, boolean>, fromIndex?: number): T[keyof T]|undefined;
  367. }
  368. interface Collection<T> {
  369. /**
  370. * @see _.findLast
  371. */
  372. findLast<S extends T>(predicate: ListIteratorTypeGuard<T, S>, fromIndex?: number): S|undefined;
  373. /**
  374. * @see _.findLast
  375. */
  376. findLast(predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): T|undefined;
  377. }
  378. interface Object<T> {
  379. /**
  380. * @see _.findLast
  381. */
  382. findLast< S extends T[keyof T]>(predicate: ObjectIteratorTypeGuard<T, S>, fromIndex?: number): S|undefined;
  383. /**
  384. * @see _.findLast
  385. */
  386. findLast(predicate?: ObjectIterateeCustom<T, boolean>, fromIndex?: number): T[keyof T]|undefined;
  387. }
  388. interface CollectionChain<T> {
  389. /**
  390. * @see _.findLast
  391. */
  392. findLast< S extends T>(predicate: ListIteratorTypeGuard<T, S>, fromIndex?: number): ExpChain<S|undefined>;
  393. /**
  394. * @see _.findLast
  395. */
  396. findLast(predicate?: ListIterateeCustom<T, boolean>, fromIndex?: number): ExpChain<T|undefined>;
  397. }
  398. interface ObjectChain<T> {
  399. /**
  400. * @see _.findLast
  401. */
  402. findLast< S extends T[keyof T]>(predicate: ObjectIteratorTypeGuard<T, S>, fromIndex?: number): ExpChain<S|undefined>;
  403. /**
  404. * @see _.findLast
  405. */
  406. findLast(predicate?: ObjectIterateeCustom<T, boolean>, fromIndex?: number): ExpChain<T[keyof T]|undefined>;
  407. }
  408. interface LoDashStatic {
  409. /**
  410. * Creates an array of flattened values by running each element in collection through iteratee
  411. * and concating its result to the other mapped values. The iteratee is invoked with three arguments:
  412. * (value, index|key, collection).
  413. *
  414. * @param collection The collection to iterate over.
  415. * @param iteratee The function invoked per iteration.
  416. * @return Returns the new flattened array.
  417. */
  418. flatMap<T>(collection: Dictionary<Many<T>> | NumericDictionary<Many<T>> | null | undefined): T[];
  419. /**
  420. * @see _.flatMap
  421. */
  422. flatMap(collection: object | null | undefined): any[];
  423. /**
  424. * @see _.flatMap
  425. */
  426. flatMap<T, TResult>(collection: List<T> | null | undefined, iteratee: ListIterator<T, Many<TResult>>): TResult[];
  427. /**
  428. * @see _.flatMap
  429. */
  430. flatMap<T extends object, TResult>(collection: T | null | undefined, iteratee: ObjectIterator<T, Many<TResult>>): TResult[];
  431. /**
  432. * @see _.flatMap
  433. */
  434. flatMap(collection: object | null | undefined, iteratee: string): any[];
  435. /**
  436. * @see _.flatMap
  437. */
  438. flatMap(collection: object | null | undefined, iteratee: object): boolean[];
  439. }
  440. interface String {
  441. /**
  442. * @see _.flatMap
  443. */
  444. flatMap<TResult>(iteratee: StringIterator<Many<TResult>>): Collection<TResult>;
  445. /**
  446. * @see _.flatMap
  447. */
  448. flatMap(): Collection<string>;
  449. }
  450. interface Collection<T> {
  451. /**
  452. * @see _.flatMap
  453. */
  454. flatMap<TResult = any>(iteratee: ListIterator<T, Many<TResult>> | PropertyName): Collection<TResult>;
  455. /**
  456. * @see _.flatMap
  457. */
  458. flatMap(iteratee: [PropertyName, any] | object): Collection<boolean>;
  459. /**
  460. * @see _.flatMap
  461. */
  462. flatMap(): T extends Many<infer U> ? Collection<U> : Collection<T>;
  463. }
  464. interface Object<T> {
  465. /**
  466. * @see _.flatMap
  467. */
  468. flatMap<TResult = any>(iteratee: ObjectIterator<T, Many<TResult>> | PropertyName): Collection<TResult>;
  469. /**
  470. * @see _.flatMap
  471. */
  472. flatMap(iteratee: [PropertyName, any] | object): Collection<boolean>;
  473. /**
  474. * @see _.flatMap
  475. */
  476. flatMap(): Collection<T[keyof T]>;
  477. }
  478. interface StringChain {
  479. /**
  480. * @see _.flatMap
  481. */
  482. flatMap<TResult>(iteratee: StringIterator<Many<TResult>>): CollectionChain<TResult>;
  483. /**
  484. * @see _.flatMap
  485. */
  486. flatMap(): CollectionChain<string>;
  487. }
  488. interface StringNullableChain {
  489. /**
  490. * @see _.flatMap
  491. */
  492. flatMap<TResult>(iteratee: StringIterator<Many<TResult>>): CollectionChain<TResult>;
  493. /**
  494. * @see _.flatMap
  495. */
  496. flatMap(): CollectionChain<string>;
  497. }
  498. interface CollectionChain<T> {
  499. /**
  500. * @see _.flatMap
  501. */
  502. flatMap<TResult = any>(iteratee: ListIterator<T, Many<TResult>> | PropertyName): CollectionChain<TResult>;
  503. /**
  504. * @see _.flatMap
  505. */
  506. flatMap(iteratee: [PropertyName, any] | object): CollectionChain<boolean>;
  507. /**
  508. * @see _.flatMap
  509. */
  510. flatMap(): T extends Many<infer U> ? CollectionChain<U> : CollectionChain<T>;
  511. }
  512. interface ObjectChain<T> {
  513. /**
  514. * @see _.flatMap
  515. */
  516. flatMap<TResult = any>(iteratee: ObjectIterator<T, Many<TResult>> | PropertyName): CollectionChain<TResult>;
  517. /**
  518. * @see _.flatMap
  519. */
  520. flatMap(iteratee: [PropertyName, any] | object): CollectionChain<boolean>;
  521. /**
  522. * @see _.flatMap
  523. */
  524. flatMap(): CollectionChain<T[keyof T]>;
  525. }
  526. interface LoDashStatic {
  527. /**
  528. * This method is like `_.flatMap` except that it recursively flattens the
  529. * mapped results.
  530. *
  531. * @since 4.7.0
  532. * @category Collection
  533. * @param collection The collection to iterate over.
  534. * @param [iteratee=_.identity] The function invoked per iteration.
  535. * @returns Returns the new flattened array.
  536. * @example
  537. *
  538. * function duplicate(n) {
  539. * return [[[n, n]]];
  540. * }
  541. *
  542. * _.flatMapDeep([1, 2], duplicate);
  543. * // => [1, 1, 2, 2]
  544. */
  545. flatMapDeep<T>(collection: Dictionary<ListOfRecursiveArraysOrValues<T> | T> | NumericDictionary<ListOfRecursiveArraysOrValues<T> | T> | null | undefined): T[];
  546. /**
  547. * @see _.flatMapDeep
  548. */
  549. flatMapDeep<T, TResult>(collection: List<T> | null | undefined, iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult>): TResult[];
  550. /**
  551. * @see _.flatMapDeep
  552. */
  553. flatMapDeep<T extends object, TResult>(collection: T | null | undefined, iteratee: ObjectIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult>): TResult[];
  554. /**
  555. * @see _.flatMapDeep
  556. */
  557. flatMapDeep(collection: object | null | undefined, iteratee: string): any[];
  558. /**
  559. * @see _.flatMapDeep
  560. */
  561. flatMapDeep(collection: object | null | undefined, iteratee: object): boolean[];
  562. }
  563. interface String {
  564. /**
  565. * @see _.flatMapDeep
  566. */
  567. flatMapDeep<TResult>(iteratee: StringIterator<ListOfRecursiveArraysOrValues<TResult> | TResult>): Collection<TResult>;
  568. /**
  569. * @see _.flatMapDeep
  570. */
  571. flatMapDeep(): Collection<string>;
  572. }
  573. interface Collection<T> {
  574. /**
  575. * @see _.flatMapDeep
  576. */
  577. flatMapDeep<TResult = any>(iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult> | PropertyName): Collection<TResult>;
  578. /**
  579. * @see _.flatMapDeep
  580. */
  581. flatMapDeep(iteratee: [PropertyName, any] | object): Collection<boolean>;
  582. /**
  583. * @see _.flatMapDeep
  584. */
  585. flatMapDeep(): Collection<T>;
  586. }
  587. interface Object<T> {
  588. /**
  589. * @see _.flatMapDeep
  590. */
  591. flatMapDeep<TResult = any>(iteratee: ObjectIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult> | PropertyName): Collection<TResult>;
  592. /**
  593. * @see _.flatMapDeep
  594. */
  595. flatMapDeep(iteratee: [PropertyName, any] | object): Collection<boolean>;
  596. /**
  597. * @see _.flatMapDeep
  598. */
  599. flatMapDeep(): Collection<T[keyof T]>;
  600. }
  601. interface StringChain {
  602. /**
  603. * @see _.flatMapDeep
  604. */
  605. flatMapDeep<TResult>(iteratee: StringIterator<ListOfRecursiveArraysOrValues<TResult> | TResult>): CollectionChain<TResult>;
  606. /**
  607. * @see _.flatMapDeep
  608. */
  609. flatMapDeep(): CollectionChain<string>;
  610. }
  611. interface StringNullableChain {
  612. /**
  613. * @see _.flatMapDeep
  614. */
  615. flatMapDeep<TResult>(iteratee: StringIterator<ListOfRecursiveArraysOrValues<TResult> | TResult>): CollectionChain<TResult>;
  616. /**
  617. * @see _.flatMapDeep
  618. */
  619. flatMapDeep(): CollectionChain<string>;
  620. }
  621. interface CollectionChain<T> {
  622. /**
  623. * @see _.flatMapDeep
  624. */
  625. flatMapDeep<TResult = any>(iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult> | PropertyName): CollectionChain<TResult>;
  626. /**
  627. * @see _.flatMapDeep
  628. */
  629. flatMapDeep(iteratee: [PropertyName, any] | object): CollectionChain<boolean>;
  630. /**
  631. * @see _.flatMapDeep
  632. */
  633. flatMapDeep(): CollectionChain<T>;
  634. }
  635. interface ObjectChain<T> {
  636. /**
  637. * @see _.flatMapDeep
  638. */
  639. flatMapDeep<TResult = any>(iteratee: ObjectIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult> | PropertyName): CollectionChain<TResult>;
  640. /**
  641. * @see _.flatMapDeep
  642. */
  643. flatMapDeep(iteratee: [PropertyName, any] | object): CollectionChain<boolean>;
  644. /**
  645. * @see _.flatMapDeep
  646. */
  647. flatMapDeep(): CollectionChain<T[keyof T]>;
  648. }
  649. interface LoDashStatic {
  650. /**
  651. * This method is like `_.flatMap` except that it recursively flattens the
  652. * mapped results up to `depth` times.
  653. *
  654. * @since 4.7.0
  655. * @category Collection
  656. * @param collection The collection to iterate over.
  657. * @param [iteratee=_.identity] The function invoked per iteration.
  658. * @param [depth=1] The maximum recursion depth.
  659. * @returns Returns the new flattened array.
  660. * @example
  661. *
  662. * function duplicate(n) {
  663. * return [[[n, n]]];
  664. * }
  665. *
  666. * _.flatMapDepth([1, 2], duplicate, 2);
  667. * // => [[1, 1], [2, 2]]
  668. */
  669. flatMapDepth<T>(collection: Dictionary<ListOfRecursiveArraysOrValues<T> | T> | NumericDictionary<ListOfRecursiveArraysOrValues<T> | T> | null | undefined): T[];
  670. /**
  671. * @see _.flatMapDepth
  672. */
  673. flatMapDepth<T, TResult>(collection: List<T> | null | undefined, iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult>, depth?: number): TResult[];
  674. /**
  675. * @see _.flatMapDepth
  676. */
  677. flatMapDepth<T extends object, TResult>(collection: T | null | undefined, iteratee: ObjectIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult>, depth?: number): TResult[];
  678. /**
  679. * @see _.flatMapDepth
  680. */
  681. flatMapDepth(collection: object | null | undefined, iteratee: string, depth?: number): any[];
  682. /**
  683. * @see _.flatMapDepth
  684. */
  685. flatMapDepth(collection: object | null | undefined, iteratee: object, depth?: number): boolean[];
  686. }
  687. interface String {
  688. /**
  689. * @see _.flatMapDepth
  690. */
  691. flatMapDepth<TResult>(iteratee: StringIterator<ListOfRecursiveArraysOrValues<TResult> | TResult>, depth?: number): Collection<TResult>;
  692. /**
  693. * @see _.flatMapDepth
  694. */
  695. flatMapDepth(depth?: number): Collection<string>;
  696. }
  697. interface Collection<T> {
  698. /**
  699. * @see _.flatMapDepth
  700. */
  701. flatMapDepth<TResult = any>(iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult> | PropertyName, depth?: number): Collection<TResult>;
  702. /**
  703. * @see _.flatMapDepth
  704. */
  705. flatMapDepth(iteratee: [PropertyName, any] | object, depth?: number): Collection<boolean>;
  706. /**
  707. * @see _.flatMapDepth
  708. */
  709. flatMapDepth(depth?: number): Collection<T>;
  710. }
  711. interface Object<T> {
  712. /**
  713. * @see _.flatMapDepth
  714. */
  715. flatMapDepth<TResult = any>(iteratee: ObjectIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult> | PropertyName, depth?: number): Collection<TResult>;
  716. /**
  717. * @see _.flatMapDepth
  718. */
  719. flatMapDepth(iteratee: [PropertyName, any] | object, depth?: number): Collection<boolean>;
  720. /**
  721. * @see _.flatMapDepth
  722. */
  723. flatMapDepth(depth?: number): Collection<T[keyof T]>;
  724. }
  725. interface StringChain {
  726. /**
  727. * @see _.flatMapDepth
  728. */
  729. flatMapDepth<TResult>(iteratee: StringIterator<ListOfRecursiveArraysOrValues<TResult> | TResult>, depth?: number): CollectionChain<TResult>;
  730. /**
  731. * @see _.flatMapDepth
  732. */
  733. flatMapDepth(depth?: number): CollectionChain<string>;
  734. }
  735. interface StringNullableChain {
  736. /**
  737. * @see _.flatMapDepth
  738. */
  739. flatMapDepth<TResult>(iteratee: StringIterator<ListOfRecursiveArraysOrValues<TResult> | TResult>, depth?: number): CollectionChain<TResult>;
  740. /**
  741. * @see _.flatMapDepth
  742. */
  743. flatMapDepth(depth?: number): CollectionChain<string>;
  744. }
  745. interface CollectionChain<T> {
  746. /**
  747. * @see _.flatMapDepth
  748. */
  749. flatMapDepth<TResult = any>(iteratee: ListIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult> | PropertyName, depth?: number): CollectionChain<TResult>;
  750. /**
  751. * @see _.flatMapDepth
  752. */
  753. flatMapDepth(iteratee: [PropertyName, any] | object, depth?: number): CollectionChain<boolean>;
  754. /**
  755. * @see _.flatMapDepth
  756. */
  757. flatMapDepth(depth?: number): CollectionChain<T>;
  758. }
  759. interface ObjectChain<T> {
  760. /**
  761. * @see _.flatMapDepth
  762. */
  763. flatMapDepth<TResult = any>(iteratee: ObjectIterator<T, ListOfRecursiveArraysOrValues<TResult> | TResult> | PropertyName, depth?: number): CollectionChain<TResult>;
  764. /**
  765. * @see _.flatMapDepth
  766. */
  767. flatMapDepth(iteratee: [PropertyName, any] | object, depth?: number): CollectionChain<boolean>;
  768. /**
  769. * @see _.flatMapDepth
  770. */
  771. flatMapDepth(depth?: number): CollectionChain<T[keyof T]>;
  772. }
  773. interface LoDashStatic {
  774. /**
  775. * Iterates over elements of collection invoking iteratee for each element. The iteratee is invoked with three arguments:
  776. * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false.
  777. *
  778. * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To
  779. * avoid this behavior _.forIn or _.forOwn may be used for object iteration.
  780. *
  781. * @alias _.each
  782. *
  783. * @param collection The collection to iterate over.
  784. * @param iteratee The function invoked per iteration.
  785. */
  786. forEach<T>(collection: T[], iteratee?: ArrayIterator<T, any>): T[];
  787. /**
  788. * @see _.forEach
  789. */
  790. forEach(collection: string, iteratee?: StringIterator<any>): string;
  791. /**
  792. * @see _.forEach
  793. */
  794. forEach<T>(collection: List<T>, iteratee?: ListIterator<T, any>): List<T>;
  795. /**
  796. * @see _.forEach
  797. */
  798. forEach<T extends object>(collection: T, iteratee?: ObjectIterator<T, any>): T;
  799. /**
  800. * @see _.forEach
  801. */
  802. forEach<T, TArray extends T[] | null | undefined>(collection: TArray & (T[] | null | undefined), iteratee?: ArrayIterator<T, any>): TArray;
  803. /**
  804. * @see _.forEach
  805. */
  806. forEach<TString extends string | null | undefined>(collection: TString, iteratee?: StringIterator<any>): TString;
  807. /**
  808. * @see _.forEach
  809. */
  810. forEach<T, TList extends List<T> | null | undefined>(collection: TList & (List<T> | null | undefined), iteratee?: ListIterator<T, any>): TList;
  811. /**
  812. * @see _.forEach
  813. */
  814. forEach<T extends object>(collection: T | null | undefined, iteratee?: ObjectIterator<T, any>): T | null | undefined;
  815. }
  816. interface String {
  817. /**
  818. * @see _.forEach
  819. */
  820. forEach(iteratee?: StringIterator<any>): String;
  821. }
  822. interface Object<T> {
  823. /**
  824. * @see _.forEach
  825. */
  826. forEach(iteratee?: ObjectIterator<T, any>): Object<T>;
  827. }
  828. interface Collection<T> {
  829. /**
  830. * @see _.forEach
  831. */
  832. forEach(iteratee?: ListIterator<T, any>): Collection<T>;
  833. }
  834. interface StringChain {
  835. /**
  836. * @see _.forEach
  837. */
  838. forEach(iteratee?: StringIterator<any>): StringChain;
  839. }
  840. interface StringNullableChain {
  841. /**
  842. * @see _.forEach
  843. */
  844. forEach(iteratee?: StringIterator<any>): StringNullableChain;
  845. }
  846. interface ObjectChain<T> {
  847. /**
  848. * @see _.forEach
  849. */
  850. forEach(iteratee?: ObjectIterator<T, any>): ObjectChain<T>;
  851. }
  852. interface CollectionChain<T> {
  853. /**
  854. * @see _.forEach
  855. */
  856. forEach(iteratee?: ListIterator<T, any>): CollectionChain<T>;
  857. }
  858. interface LoDashStatic {
  859. /**
  860. * This method is like _.forEach except that it iterates over elements of collection from right to left.
  861. *
  862. * @alias _.eachRight
  863. *
  864. * @param collection The collection to iterate over.
  865. * @param iteratee The function called per iteration.
  866. */
  867. forEachRight<T>(collection: T[], iteratee?: ArrayIterator<T, any>): T[];
  868. /**
  869. * @see _.forEachRight
  870. */
  871. forEachRight(collection: string, iteratee?: StringIterator<any>): string;
  872. /**
  873. * @see _.forEachRight
  874. */
  875. forEachRight<T>(collection: List<T>, iteratee?: ListIterator<T, any>): List<T>;
  876. /**
  877. * @see _.forEachRight
  878. */
  879. forEachRight<T extends object>(collection: T, iteratee?: ObjectIterator<T, any>): T;
  880. /**
  881. * @see _.forEachRight
  882. */
  883. forEachRight<T, TArray extends T[] | null | undefined>(collection: TArray & (T[] | null | undefined), iteratee?: ArrayIterator<T, any>): TArray;
  884. /**
  885. * @see _.forEachRight
  886. */
  887. forEachRight<TString extends string | null | undefined>(collection: TString, iteratee?: StringIterator<any>): TString;
  888. /**
  889. * @see _.forEachRight
  890. */
  891. forEachRight<T, TList extends List<T> | null | undefined>(collection: TList & (List<T> | null | undefined), iteratee?: ListIterator<T, any>): TList;
  892. /**
  893. * @see _.forEachRight
  894. */
  895. forEachRight<T extends object>(collection: T | null | undefined, iteratee?: ObjectIterator<T, any>): T | null | undefined;
  896. }
  897. interface String {
  898. /**
  899. * @see _.forEachRight
  900. */
  901. forEachRight(iteratee?: StringIterator<any>): String;
  902. }
  903. interface Object<T> {
  904. /**
  905. * @see _.forEachRight
  906. */
  907. forEachRight(iteratee?: ObjectIterator<T, any>): Object<T>;
  908. }
  909. interface Collection<T> {
  910. /**
  911. * @see _.forEachRight
  912. */
  913. forEachRight(iteratee?: ListIterator<T, any>): Collection<T>;
  914. }
  915. interface StringChain {
  916. /**
  917. * @see _.forEachRight
  918. */
  919. forEachRight(iteratee?: StringIterator<any>): StringChain;
  920. }
  921. interface StringNullableChain {
  922. /**
  923. * @see _.forEachRight
  924. */
  925. forEachRight(iteratee?: StringIterator<any>): StringNullableChain;
  926. }
  927. interface ObjectChain<T> {
  928. /**
  929. * @see _.forEachRight
  930. */
  931. forEachRight(iteratee?: ObjectIterator<T, any>): ObjectChain<T>;
  932. }
  933. interface CollectionChain<T> {
  934. /**
  935. * @see _.forEachRight
  936. */
  937. forEachRight(iteratee?: ListIterator<T, any>): CollectionChain<T>;
  938. }
  939. interface LoDashStatic {
  940. /**
  941. * Creates an object composed of keys generated from the results of running each element of collection through
  942. * iteratee. The corresponding value of each key is an array of the elements responsible for generating the
  943. * key. The iteratee is invoked with one argument: (value).
  944. *
  945. * @param collection The collection to iterate over.
  946. * @param iteratee The function invoked per iteration.
  947. * @return Returns the composed aggregate object.
  948. */
  949. groupBy<T>(collection: List<T> | null | undefined, iteratee?: ValueIteratee<T>): Dictionary<T[]>;
  950. /**
  951. * @see _.groupBy
  952. */
  953. groupBy<T extends object>(collection: T | null | undefined, iteratee?: ValueIteratee<T[keyof T]>): Dictionary<Array<T[keyof T]>>;
  954. }
  955. interface String {
  956. /**
  957. * @see _.groupBy
  958. */
  959. groupBy(iteratee?: ValueIteratee<string>): Object<Dictionary<string[]>>;
  960. }
  961. interface Collection<T> {
  962. /**
  963. * @see _.groupBy
  964. */
  965. groupBy(iteratee?: ValueIteratee<T>): Object<Dictionary<T[]>>;
  966. }
  967. interface Object<T> {
  968. /**
  969. * @see _.groupBy
  970. */
  971. groupBy(iteratee?: ValueIteratee<T[keyof T]>): Object<Dictionary<Array<T[keyof T]>>>;
  972. }
  973. interface StringChain {
  974. /**
  975. * @see _.groupBy
  976. */
  977. groupBy(iteratee?: ValueIteratee<string>): ObjectChain<Dictionary<string[]>>;
  978. }
  979. interface StringNullableChain {
  980. /**
  981. * @see _.groupBy
  982. */
  983. groupBy(iteratee?: ValueIteratee<string>): ObjectChain<Dictionary<string[]>>;
  984. }
  985. interface CollectionChain<T> {
  986. /**
  987. * @see _.groupBy
  988. */
  989. groupBy(iteratee?: ValueIteratee<T>): ObjectChain<Dictionary<T[]>>;
  990. }
  991. interface ObjectChain<T> {
  992. /**
  993. * @see _.groupBy
  994. */
  995. groupBy(iteratee?: ValueIteratee<T[keyof T]>): ObjectChain<Dictionary<Array<T[keyof T]>>>;
  996. }
  997. interface LoDashStatic {
  998. /**
  999. * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative,
  1000. * it’s used as the offset from the end of collection.
  1001. *
  1002. * @param collection The collection to search.
  1003. * @param target The value to search for.
  1004. * @param fromIndex The index to search from.
  1005. * @return True if the target element is found, else false.
  1006. */
  1007. includes<T>(collection: Dictionary<T> | NumericDictionary<T> | null | undefined, target: T, fromIndex?: number): boolean;
  1008. }
  1009. interface Object<T> {
  1010. /**
  1011. * @see _.includes
  1012. */
  1013. includes(target: T[keyof T], fromIndex?: number): boolean;
  1014. }
  1015. interface Collection<T> {
  1016. /**
  1017. * @see _.includes
  1018. */
  1019. includes(target: T, fromIndex?: number): boolean;
  1020. }
  1021. interface String {
  1022. /**
  1023. * @see _.includes
  1024. */
  1025. includes(target: string, fromIndex?: number): boolean;
  1026. }
  1027. interface ObjectChain<T> {
  1028. /**
  1029. * @see _.includes
  1030. */
  1031. includes(target: T[keyof T], fromIndex?: number): PrimitiveChain<boolean>;
  1032. }
  1033. interface CollectionChain<T> {
  1034. /**
  1035. * @see _.includes
  1036. */
  1037. includes(target: T, fromIndex?: number): PrimitiveChain<boolean>;
  1038. }
  1039. interface StringChain {
  1040. /**
  1041. * @see _.includes
  1042. */
  1043. includes(target: string, fromIndex?: number): PrimitiveChain<boolean>;
  1044. }
  1045. interface LoDashStatic {
  1046. /**
  1047. * Invokes the method named by methodName on each element in the collection returning
  1048. * an array of the results of each invoked method. Additional arguments will be provided
  1049. * to each invoked method. If methodName is a function it will be invoked for, and this
  1050. * bound to, each element in the collection.
  1051. * @param collection The collection to iterate over.
  1052. * @param methodName The name of the method to invoke.
  1053. * @param args Arguments to invoke the method with.
  1054. */
  1055. invokeMap(collection: object | null | undefined, methodName: string, ...args: any[]): any[];
  1056. /**
  1057. * @see _.invokeMap
  1058. */
  1059. invokeMap<TResult>(collection: object | null | undefined, method: (...args: any[]) => TResult, ...args: any[]): TResult[];
  1060. }
  1061. interface LoDashImplicitWrapper<TValue> {
  1062. /**
  1063. * @see _.invokeMap
  1064. */
  1065. invokeMap(methodName: string, ...args: any[]): Collection<any>;
  1066. /**
  1067. * @see _.invokeMap
  1068. */
  1069. invokeMap<TResult>(method: (...args: any[]) => TResult, ...args: any[]): Collection<TResult>;
  1070. }
  1071. interface LoDashExplicitWrapper<TValue> {
  1072. /**
  1073. * @see _.invokeMap
  1074. */
  1075. invokeMap(methodName: string, ...args: any[]): CollectionChain<any>;
  1076. /**
  1077. * @see _.invokeMap
  1078. */
  1079. invokeMap<TResult>(method: (...args: any[]) => TResult, ...args: any[]): CollectionChain<TResult>;
  1080. }
  1081. interface LoDashStatic {
  1082. /**
  1083. * Creates an object composed of keys generated from the results of running each element of collection through
  1084. * iteratee. The corresponding value of each key is the last element responsible for generating the key. The
  1085. * iteratee function is invoked with one argument: (value).
  1086. *
  1087. * @param collection The collection to iterate over.
  1088. * @param iteratee The function invoked per iteration.
  1089. * @return Returns the composed aggregate object.
  1090. */
  1091. keyBy<T>(collection: List<T> | null | undefined, iteratee?: ValueIterateeCustom<T, PropertyName>): Dictionary<T>;
  1092. /**
  1093. * @see _.keyBy
  1094. */
  1095. keyBy<T extends object>(collection: T | null | undefined, iteratee?: ValueIterateeCustom<T[keyof T], PropertyName>): Dictionary<T[keyof T]>;
  1096. }
  1097. interface String {
  1098. /**
  1099. * @see _.keyBy
  1100. */
  1101. keyBy(iteratee?: ValueIterateeCustom<string, PropertyName>): Object<Dictionary<string>>;
  1102. }
  1103. interface Collection<T> {
  1104. /**
  1105. * @see _.keyBy
  1106. */
  1107. keyBy(iteratee?: ValueIterateeCustom<T, PropertyName>): Object<Dictionary<T>>;
  1108. }
  1109. interface Object<T> {
  1110. /**
  1111. * @see _.keyBy
  1112. */
  1113. keyBy(iteratee?: ValueIterateeCustom<T[keyof T], PropertyName>): Object<Dictionary<T[keyof T]>>;
  1114. }
  1115. interface StringChain {
  1116. /**
  1117. * @see _.keyBy
  1118. */
  1119. keyBy(iteratee?: ValueIterateeCustom<string, PropertyName>): ObjectChain<Dictionary<string>>;
  1120. }
  1121. interface StringNullableChain {
  1122. /**
  1123. * @see _.keyBy
  1124. */
  1125. keyBy(iteratee?: ValueIterateeCustom<string, PropertyName>): ObjectChain<Dictionary<string>>;
  1126. }
  1127. interface CollectionChain<T> {
  1128. /**
  1129. * @see _.keyBy
  1130. */
  1131. keyBy(iteratee?: ValueIterateeCustom<T, PropertyName>): ObjectChain<Dictionary<T>>;
  1132. }
  1133. interface ObjectChain<T> {
  1134. /**
  1135. * @see _.keyBy
  1136. */
  1137. keyBy(iteratee?: ValueIterateeCustom<T[keyof T], PropertyName>): ObjectChain<Dictionary<T[keyof T]>>;
  1138. }
  1139. interface LoDashStatic {
  1140. /**
  1141. * Creates an array of values by running each element in collection through iteratee. The iteratee is
  1142. * invoked with three arguments: (value, index|key, collection).
  1143. *
  1144. * Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues,
  1145. * _.reject, and _.some.
  1146. *
  1147. * The guarded methods are:
  1148. * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max,
  1149. * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range,
  1150. * sample, some, sum, uniq, and words
  1151. *
  1152. * @param collection The collection to iterate over.
  1153. * @param iteratee The function invoked per iteration.
  1154. * @return Returns the new mapped array.
  1155. */
  1156. map<T extends readonly [unknown, ...unknown[]], TResult>(collection: T, iteratee: TupleIterator<T, TResult>): { [K in keyof T]: TResult };
  1157. /**
  1158. * @see _.map
  1159. */
  1160. map<T, TResult>(collection: T[] | null | undefined, iteratee: ArrayIterator<T, TResult>): TResult[];
  1161. /**
  1162. * @see _.map
  1163. */
  1164. map<T, TResult>(collection: List<T> | null | undefined, iteratee: ListIterator<T, TResult>): TResult[];
  1165. /**
  1166. * @see _.map
  1167. */
  1168. map<T>(collection: Dictionary<T> | NumericDictionary<T> | null | undefined): T[];
  1169. /**
  1170. * @see _.map
  1171. */
  1172. map<T extends object, TResult>(collection: T | null | undefined, iteratee: ObjectIterator<T, TResult>): TResult[];
  1173. /**
  1174. * @see _.map
  1175. */
  1176. map<T, K extends keyof T>(collection: Dictionary<T> | NumericDictionary<T> | null | undefined, iteratee: K): Array<T[K]>;
  1177. /**
  1178. * @see _.map
  1179. */
  1180. map<T>(collection: Dictionary<T> | NumericDictionary<T> | null | undefined, iteratee?: string): any[];
  1181. /**
  1182. * @see _.map
  1183. */
  1184. map<T>(collection: Dictionary<T> | NumericDictionary<T> | null | undefined, iteratee?: object): boolean[];
  1185. }
  1186. interface String {
  1187. /**
  1188. * @see _.map
  1189. */
  1190. map<TResult>(iteratee: StringIterator<TResult>): Collection<TResult>;
  1191. /**
  1192. * @see _.map
  1193. */
  1194. map(): Collection<string>;
  1195. }
  1196. interface Collection<T> {
  1197. /**
  1198. * @see _.map
  1199. */
  1200. map<K extends keyof T>(key: K): Collection<T[K]>;
  1201. /**
  1202. * @see _.map
  1203. */
  1204. map<TResult>(iteratee: ListIterator<T, TResult>): Collection<TResult>;
  1205. /**
  1206. * @see _.map
  1207. */
  1208. map(iteratee: PropertyName): Collection<any>;
  1209. /**
  1210. * @see _.map
  1211. */
  1212. map(iteratee: [PropertyName, any] | object): Collection<boolean>;
  1213. /**
  1214. * @see _.map
  1215. */
  1216. map(): Collection<T>;
  1217. }
  1218. interface Object<T> {
  1219. /**
  1220. * @see _.map
  1221. */
  1222. map<K extends keyof T[keyof T]>(key: K): Collection<T[keyof T][K]>;
  1223. /**
  1224. * @see _.map
  1225. */
  1226. map<TResult>(iteratee: ObjectIterator<T, TResult>): Collection<TResult>;
  1227. /**
  1228. * @see _.map
  1229. */
  1230. map(iteratee: PropertyName): Collection<any>;
  1231. /**
  1232. * @see _.map
  1233. */
  1234. map(iteratee: [PropertyName, any] | object): Collection<boolean>;
  1235. /**
  1236. * @see _.map
  1237. */
  1238. map(): Collection<T[keyof T]>;
  1239. }
  1240. interface StringChain {
  1241. /**
  1242. * @see _.map
  1243. */
  1244. map<TResult>(iteratee: StringIterator<TResult>): CollectionChain<TResult>;
  1245. /**
  1246. * @see _.map
  1247. */
  1248. map(): CollectionChain<string>;
  1249. }
  1250. interface StringNullableChain {
  1251. /**
  1252. * @see _.map
  1253. */
  1254. map<TResult>(iteratee: StringIterator<TResult>): CollectionChain<TResult>;
  1255. /**
  1256. * @see _.map
  1257. */
  1258. map(): CollectionChain<string>;
  1259. }
  1260. interface CollectionChain<T> {
  1261. /**
  1262. * @see _.map
  1263. */
  1264. map<K extends keyof T>(key: K): CollectionChain<T[K]>;
  1265. /**
  1266. * @see _.map
  1267. */
  1268. map<TResult>(iteratee: ListIterator<T, TResult>): CollectionChain<TResult>;
  1269. /**
  1270. * @see _.map
  1271. */
  1272. map(iteratee: PropertyName): CollectionChain<any>;
  1273. /**
  1274. * @see _.map
  1275. */
  1276. map(iteratee: [PropertyName, any] | object): CollectionChain<boolean>;
  1277. /**
  1278. * @see _.map
  1279. */
  1280. map(): CollectionChain<T>;
  1281. }
  1282. interface ObjectChain<T> {
  1283. /**
  1284. * @see _.map
  1285. */
  1286. map<K extends keyof T[keyof T]>(key: K): CollectionChain<T[keyof T][K]>;
  1287. /**
  1288. * @see _.map
  1289. */
  1290. map<TResult>(iteratee: ObjectIterator<T, TResult>): CollectionChain<TResult>;
  1291. /**
  1292. * @see _.map
  1293. */
  1294. map(iteratee: PropertyName): CollectionChain<any>;
  1295. /**
  1296. * @see _.map
  1297. */
  1298. map(iteratee: [PropertyName, any] | object): CollectionChain<boolean>;
  1299. /**
  1300. * @see _.map
  1301. */
  1302. map(): CollectionChain<T[keyof T]>;
  1303. }
  1304. interface LoDashStatic {
  1305. /**
  1306. * This method is like `_.sortBy` except that it allows specifying the sort
  1307. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  1308. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  1309. * descending or "asc" for ascending sort order of corresponding values.
  1310. *
  1311. * @category Collection
  1312. * @param collection The collection to iterate over.
  1313. * @param [iteratees=[_.identity]] The iteratees to sort by.
  1314. * @param [orders] The sort orders of `iteratees`.
  1315. * @param [guard] Enables use as an iteratee for functions like `_.reduce`.
  1316. * @returns Returns the new sorted array.
  1317. * @example
  1318. *
  1319. * var users = [
  1320. * { 'user': 'fred', 'age': 48 },
  1321. * { 'user': 'barney', 'age': 34 },
  1322. * { 'user': 'fred', 'age': 42 },
  1323. * { 'user': 'barney', 'age': 36 }
  1324. * ];
  1325. *
  1326. * // sort by `user` in ascending order and by `age` in descending order
  1327. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  1328. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
  1329. */
  1330. orderBy<T>(collection: List<T> | null | undefined, iteratees?: Many<ListIterator<T, NotVoid>>, orders?: Many<boolean|"asc"|"desc">): T[];
  1331. /**
  1332. * @see _.orderBy
  1333. */
  1334. orderBy<T>(collection: List<T> | null | undefined, iteratees?: Many<ListIteratee<T>>, orders?: Many<boolean|"asc"|"desc">): T[];
  1335. /**
  1336. * @see _.orderBy
  1337. */
  1338. orderBy<T extends object>(collection: T | null | undefined, iteratees?: Many<ObjectIterator<T, NotVoid>>, orders?: Many<boolean|"asc"|"desc">): Array<T[keyof T]>;
  1339. /**
  1340. * @see _.orderBy
  1341. */
  1342. orderBy<T extends object>(collection: T | null | undefined, iteratees?: Many<ObjectIteratee<T>>, orders?: Many<boolean|"asc"|"desc">): Array<T[keyof T]>;
  1343. }
  1344. interface Collection<T> {
  1345. /**
  1346. * @see _.orderBy
  1347. */
  1348. orderBy(iteratees?: Many<ListIterator<T, NotVoid> | PropertyName | PartialShallow<T>>, orders?: Many<boolean|"asc"|"desc">): Collection<T>;
  1349. }
  1350. interface Object<T> {
  1351. /**
  1352. * @see _.orderBy
  1353. */
  1354. orderBy(iteratees?: Many<ObjectIterator<T, NotVoid>>, orders?: Many<boolean|"asc"|"desc">): Collection<T[keyof T]>;
  1355. }
  1356. interface CollectionChain<T> {
  1357. /**
  1358. * @see _.orderBy
  1359. */
  1360. orderBy(iteratees?: Many<ListIterator<T, NotVoid> | PropertyName | PartialShallow<T>>, orders?: Many<boolean|"asc"|"desc">): CollectionChain<T>;
  1361. }
  1362. interface ObjectChain<T> {
  1363. /**
  1364. * @see _.orderBy
  1365. */
  1366. orderBy(iteratees?: Many<ObjectIterator<T, NotVoid>>, orders?: Many<boolean|"asc"|"desc">): CollectionChain<T[keyof T]>;
  1367. }
  1368. interface LoDashStatic {
  1369. /**
  1370. * Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for,
  1371. * while the second of which contains elements predicate returns falsey for.
  1372. * The predicate is invoked with three arguments: (value, index|key, collection).
  1373. *
  1374. * @param collection The collection to iterate over.
  1375. * @param callback The function called per iteration.
  1376. * @return Returns the array of grouped elements.
  1377. */
  1378. partition<T, U extends T>(collection: List<T> | null | undefined, callback: ValueIteratorTypeGuard<T, U>): [U[], Array<Exclude<T, U>>];
  1379. /**
  1380. * @see _.partition
  1381. */
  1382. partition<T>(collection: List<T> | null | undefined, callback: ValueIteratee<T>): [T[], T[]];
  1383. /**
  1384. * @see _.partition
  1385. */
  1386. partition<T extends object>(collection: T | null | undefined, callback: ValueIteratee<T[keyof T]>): [Array<T[keyof T]>, Array<T[keyof T]>];
  1387. }
  1388. interface String {
  1389. /**
  1390. * @see _.partition
  1391. */
  1392. partition(callback: StringIterator<NotVoid>): LoDashImplicitWrapper<[string[], string[]]>;
  1393. }
  1394. interface Collection<T> {
  1395. /**
  1396. * @see _.partition
  1397. */
  1398. partition<U extends T>(callback: ValueIteratorTypeGuard<T, U>): LoDashImplicitWrapper<[U[], Array<Exclude<T, U>>]>;
  1399. /**
  1400. * @see _.partition
  1401. */
  1402. partition(callback: ValueIteratee<T>): LoDashImplicitWrapper<[T[], T[]]>;
  1403. }
  1404. interface Object<T> {
  1405. /**
  1406. * @see _.partition
  1407. */
  1408. partition(callback: ValueIteratee<T[keyof T]>): LoDashImplicitWrapper<[Array<T[keyof T]>, Array<T[keyof T]>]>;
  1409. }
  1410. interface StringChain {
  1411. /**
  1412. * @see _.partition
  1413. */
  1414. partition(callback: StringIterator<NotVoid>): LoDashExplicitWrapper<[string[], string[]]>;
  1415. }
  1416. interface StringNullableChain {
  1417. /**
  1418. * @see _.partition
  1419. */
  1420. partition(callback: StringIterator<NotVoid>): LoDashExplicitWrapper<[string[], string[]]>;
  1421. }
  1422. interface CollectionChain<T> {
  1423. /**
  1424. * @see _.partition
  1425. */
  1426. partition<U extends T>(callback: ValueIteratorTypeGuard<T, U>): LoDashExplicitWrapper<[U[], Array<Exclude<T, U>>]>;
  1427. /**
  1428. * @see _.partition
  1429. */
  1430. partition(callback: ValueIteratee<T>): LoDashExplicitWrapper<[T[], T[]]>;
  1431. }
  1432. interface ObjectChain<T> {
  1433. /**
  1434. * @see _.partition
  1435. */
  1436. partition(callback: ValueIteratee<T[keyof T]>): LoDashExplicitWrapper<[Array<T[keyof T]>, Array<T[keyof T]>]>;
  1437. }
  1438. interface LoDashStatic {
  1439. /**
  1440. * Reduces a collection to a value which is the accumulated result of running each
  1441. * element in the collection through the callback, where each successive callback execution
  1442. * consumes the return value of the previous execution. If accumulator is not provided the
  1443. * first element of the collection will be used as the initial accumulator value. The callback
  1444. * is invoked with four arguments: (accumulator, value, index|key, collection).
  1445. * @param collection The collection to iterate over.
  1446. * @param callback The function called per iteration.
  1447. * @param accumulator Initial value of the accumulator.
  1448. * @return Returns the accumulated value.
  1449. */
  1450. reduce<T, TResult>(collection: T[] | null | undefined, callback: MemoListIterator<T, TResult, T[]>, accumulator: TResult): TResult;
  1451. /**
  1452. * @see _.reduce
  1453. */
  1454. reduce<T, TResult>(collection: List<T> | null | undefined, callback: MemoListIterator<T, TResult, List<T>>, accumulator: TResult): TResult;
  1455. /**
  1456. * @see _.reduce
  1457. */
  1458. reduce<T extends object, TResult>(collection: T | null | undefined, callback: MemoObjectIterator<T[keyof T], TResult, T>, accumulator: TResult): TResult;
  1459. /**
  1460. * @see _.reduce
  1461. */
  1462. reduce<T>(collection: T[] | null | undefined, callback: MemoListIterator<T, T, T[]>): T | undefined;
  1463. /**
  1464. * @see _.reduce
  1465. */
  1466. reduce<T>(collection: List<T> | null | undefined, callback: MemoListIterator<T, T, List<T>>): T | undefined;
  1467. /**
  1468. * @see _.reduce
  1469. */
  1470. reduce<T extends object>(collection: T | null | undefined, callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): T[keyof T] | undefined;
  1471. }
  1472. interface Collection<T> {
  1473. /**
  1474. * @see _.reduce
  1475. */
  1476. reduce<TResult>(callback: MemoListIterator<T, TResult, List<T>>, accumulator: TResult): TResult;
  1477. /**
  1478. * @see _.reduce
  1479. */
  1480. reduce(callback: MemoListIterator<T, T, List<T>>): T | undefined;
  1481. }
  1482. interface Object<T> {
  1483. /**
  1484. * @see _.reduce
  1485. */
  1486. reduce<TResult>(callback: MemoObjectIterator<T[keyof T], TResult, T>, accumulator: TResult): TResult;
  1487. /**
  1488. * @see _.reduce
  1489. */
  1490. reduce(callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): T[keyof T] | undefined;
  1491. }
  1492. interface CollectionChain<T> {
  1493. /**
  1494. * @see _.reduce
  1495. */
  1496. reduce<TResult>(callback: MemoListIterator<T, TResult, List<T>>, accumulator: TResult): ExpChain<TResult>;
  1497. /**
  1498. * @see _.reduce
  1499. */
  1500. reduce(callback: MemoListIterator<T, T, List<T>>): ExpChain<T | undefined>;
  1501. }
  1502. interface ObjectChain<T> {
  1503. /**
  1504. * @see _.reduce
  1505. */
  1506. reduce<TResult>(callback: MemoObjectIterator<T[keyof T], TResult, T>, accumulator: TResult): ExpChain<TResult>;
  1507. /**
  1508. * @see _.reduce
  1509. */
  1510. reduce(callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): ExpChain<T[keyof T] | undefined>;
  1511. }
  1512. interface LoDashStatic {
  1513. /**
  1514. * This method is like _.reduce except that it iterates over elements of a collection from
  1515. * right to left.
  1516. * @param collection The collection to iterate over.
  1517. * @param callback The function called per iteration.
  1518. * @param accumulator Initial value of the accumulator.
  1519. * @return The accumulated value.
  1520. */
  1521. reduceRight<T, TResult>(collection: T[] | null | undefined, callback: MemoListIterator<T, TResult, T[]>, accumulator: TResult): TResult;
  1522. /**
  1523. * @see _.reduceRight
  1524. */
  1525. reduceRight<T, TResult>(collection: List<T> | null | undefined, callback: MemoListIterator<T, TResult, List<T>>, accumulator: TResult): TResult;
  1526. /**
  1527. * @see _.reduceRight
  1528. */
  1529. reduceRight<T extends object, TResult>(collection: T | null | undefined, callback: MemoObjectIterator<T[keyof T], TResult, T>, accumulator: TResult): TResult;
  1530. /**
  1531. * @see _.reduceRight
  1532. */
  1533. reduceRight<T>(collection: T[] | null | undefined, callback: MemoListIterator<T, T, T[]>): T | undefined;
  1534. /**
  1535. * @see _.reduceRight
  1536. */
  1537. reduceRight<T>(collection: List<T> | null | undefined, callback: MemoListIterator<T, T, List<T>>): T | undefined;
  1538. /**
  1539. * @see _.reduceRight
  1540. */
  1541. reduceRight<T extends object>(collection: T | null | undefined, callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): T[keyof T] | undefined;
  1542. }
  1543. interface Collection<T> {
  1544. /**
  1545. * @see _.reduceRight
  1546. */
  1547. reduceRight<TResult>(callback: MemoListIterator<T, TResult, List<T>>, accumulator: TResult): TResult;
  1548. /**
  1549. * @see _.reduceRight
  1550. */
  1551. reduceRight(callback: MemoListIterator<T, T, List<T>>): T | undefined;
  1552. }
  1553. interface Object<T> {
  1554. /**
  1555. * @see _.reduceRight
  1556. */
  1557. reduceRight<TResult>(callback: MemoObjectIterator<T[keyof T], TResult, T>, accumulator: TResult): TResult;
  1558. /**
  1559. * @see _.reduceRight
  1560. */
  1561. reduceRight(callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): T[keyof T] | undefined;
  1562. }
  1563. interface CollectionChain<T> {
  1564. /**
  1565. * @see _.reduceRight
  1566. */
  1567. reduceRight<TResult>(callback: MemoListIterator<T, TResult, List<T>>, accumulator: TResult): ExpChain<TResult>;
  1568. /**
  1569. * @see _.reduceRight
  1570. */
  1571. reduceRight(callback: MemoListIterator<T, T, List<T>>): ExpChain<T | undefined>;
  1572. }
  1573. interface ObjectChain<T> {
  1574. /**
  1575. * @see _.reduceRight
  1576. */
  1577. reduceRight<TResult>(callback: MemoObjectIterator<T[keyof T], TResult, T>, accumulator: TResult): ExpChain<TResult>;
  1578. /**
  1579. * @see _.reduceRight
  1580. */
  1581. reduceRight(callback: MemoObjectIterator<T[keyof T], T[keyof T], T>): ExpChain<T[keyof T] | undefined>;
  1582. }
  1583. interface LoDashStatic {
  1584. /**
  1585. * The opposite of _.filter; this method returns the elements of collection that predicate does not return
  1586. * truthy for.
  1587. *
  1588. * @param collection The collection to iterate over.
  1589. * @param predicate The function invoked per iteration.
  1590. * @return Returns the new filtered array.
  1591. */
  1592. reject(collection: string | null | undefined, predicate?: StringIterator<boolean>): string[];
  1593. /**
  1594. * @see _.reject
  1595. */
  1596. reject<T>(collection: List<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>): T[];
  1597. /**
  1598. * @see _.reject
  1599. */
  1600. reject<T extends object>(collection: T | null | undefined, predicate?: ObjectIterateeCustom<T, boolean>): Array<T[keyof T]>;
  1601. }
  1602. interface String {
  1603. /**
  1604. * @see _.reject
  1605. */
  1606. reject(predicate?: StringIterator<boolean>): Collection<string>;
  1607. }
  1608. interface Collection<T> {
  1609. /**
  1610. * @see _.reject
  1611. */
  1612. reject(predicate?: ListIterateeCustom<T, boolean>): Collection<T>;
  1613. }
  1614. interface Object<T> {
  1615. /**
  1616. * @see _.reject
  1617. */
  1618. reject(predicate?: ObjectIterateeCustom<T, boolean>): Collection<T[keyof T]>;
  1619. }
  1620. interface StringChain {
  1621. /**
  1622. * @see _.reject
  1623. */
  1624. reject(predicate?: StringIterator<boolean>): CollectionChain<string>;
  1625. }
  1626. interface StringNullableChain {
  1627. /**
  1628. * @see _.reject
  1629. */
  1630. reject(predicate?: StringIterator<boolean>): CollectionChain<string>;
  1631. }
  1632. interface CollectionChain<T> {
  1633. /**
  1634. * @see _.reject
  1635. */
  1636. reject(predicate?: ListIterateeCustom<T, boolean>): CollectionChain<T>;
  1637. }
  1638. interface ObjectChain<T> {
  1639. /**
  1640. * @see _.reject
  1641. */
  1642. reject(predicate?: ObjectIterateeCustom<T, boolean>): CollectionChain<T[keyof T]>;
  1643. }
  1644. interface LoDashStatic {
  1645. /**
  1646. * Gets a random element from collection.
  1647. *
  1648. * @param collection The collection to sample.
  1649. * @return Returns the random element.
  1650. */
  1651. sample<T>(collection: readonly [T, ...T[]]): T;
  1652. /**
  1653. * @see _.sample
  1654. */
  1655. sample<T>(collection: Dictionary<T> | NumericDictionary<T> | null | undefined): T | undefined;
  1656. /**
  1657. * @see _.sample
  1658. */
  1659. sample<T extends object>(collection: T | null | undefined): T[keyof T] | undefined;
  1660. }
  1661. interface String {
  1662. /**
  1663. * @see _.sample
  1664. */
  1665. sample(): string | undefined;
  1666. }
  1667. interface Collection<T> {
  1668. /**
  1669. * @see _.sample
  1670. */
  1671. sample(): T | undefined;
  1672. }
  1673. interface Object<T> {
  1674. /**
  1675. * @see _.sample
  1676. */
  1677. sample(): T[keyof T] | undefined;
  1678. }
  1679. interface StringChain {
  1680. /**
  1681. * @see _.sample
  1682. */
  1683. sample(): StringNullableChain;
  1684. }
  1685. interface StringNullableChain {
  1686. /**
  1687. * @see _.sample
  1688. */
  1689. sample(): StringNullableChain;
  1690. }
  1691. interface CollectionChain<T> {
  1692. /**
  1693. * @see _.sample
  1694. */
  1695. sample(): ExpChain<T | undefined>;
  1696. }
  1697. interface ObjectChain<T> {
  1698. /**
  1699. * @see _.sample
  1700. */
  1701. sample(): ExpChain<T[keyof T] | undefined>;
  1702. }
  1703. interface LoDashStatic {
  1704. /**
  1705. * Gets n random elements at unique keys from collection up to the size of collection.
  1706. *
  1707. * @param collection The collection to sample.
  1708. * @param n The number of elements to sample.
  1709. * @return Returns the random elements.
  1710. */
  1711. sampleSize<T>(collection: Dictionary<T> | NumericDictionary<T> | null | undefined, n?: number): T[];
  1712. /**
  1713. * @see _.sampleSize
  1714. */
  1715. sampleSize<T extends object>(collection: T | null | undefined, n?: number): Array<T[keyof T]>;
  1716. }
  1717. interface String {
  1718. /**
  1719. * @see _.sampleSize
  1720. */
  1721. sampleSize(n?: number): Collection<string>;
  1722. }
  1723. interface Collection<T> {
  1724. /**
  1725. * @see _.sampleSize
  1726. */
  1727. sampleSize(n?: number): Collection<T>;
  1728. }
  1729. interface Object<T> {
  1730. /**
  1731. * @see _.sampleSize
  1732. */
  1733. sampleSize(n?: number): Collection<T[keyof T]>;
  1734. }
  1735. interface StringChain {
  1736. /**
  1737. * @see _.sampleSize
  1738. */
  1739. sampleSize(n?: number): CollectionChain<string>;
  1740. }
  1741. interface StringNullableChain {
  1742. /**
  1743. * @see _.sampleSize
  1744. */
  1745. sampleSize(n?: number): CollectionChain<string>;
  1746. }
  1747. interface CollectionChain<T> {
  1748. /**
  1749. * @see _.sampleSize
  1750. */
  1751. sampleSize(n?: number): CollectionChain<T>;
  1752. }
  1753. interface ObjectChain<T> {
  1754. /**
  1755. * @see _.sampleSize
  1756. */
  1757. sampleSize(n?: number): CollectionChain<T[keyof T]>;
  1758. }
  1759. interface LoDashStatic {
  1760. /**
  1761. * Creates an array of shuffled values, using a version of the Fisher-Yates shuffle.
  1762. *
  1763. * @param collection The collection to shuffle.
  1764. * @return Returns the new shuffled array.
  1765. */
  1766. shuffle<T>(collection: List<T> | null | undefined): T[];
  1767. /**
  1768. * @see _.shuffle
  1769. */
  1770. shuffle<T extends object>(collection: T | null | undefined): Array<T[keyof T]>;
  1771. }
  1772. interface String {
  1773. /**
  1774. * @see _.shuffle
  1775. */
  1776. shuffle(): Collection<string>;
  1777. }
  1778. interface Collection<T> {
  1779. /**
  1780. * @see _.shuffle
  1781. */
  1782. shuffle(): Collection<T>;
  1783. }
  1784. interface Object<T> {
  1785. /**
  1786. * @see _.shuffle
  1787. */
  1788. shuffle(): Collection<T[keyof T]>;
  1789. }
  1790. interface StringChain {
  1791. /**
  1792. * @see _.shuffle
  1793. */
  1794. shuffle(): CollectionChain<string>;
  1795. }
  1796. interface StringNullableChain {
  1797. /**
  1798. * @see _.shuffle
  1799. */
  1800. shuffle(): CollectionChain<string>;
  1801. }
  1802. interface CollectionChain<T> {
  1803. /**
  1804. * @see _.shuffle
  1805. */
  1806. shuffle(): CollectionChain<T>;
  1807. }
  1808. interface ObjectChain<T> {
  1809. /**
  1810. * @see _.shuffle
  1811. */
  1812. shuffle(): CollectionChain<T[keyof T]>;
  1813. }
  1814. interface LoDashStatic {
  1815. /**
  1816. * Gets the size of collection by returning its length for array-like values or the number of own enumerable
  1817. * properties for objects.
  1818. *
  1819. * @param collection The collection to inspect.
  1820. * @return Returns the size of collection.
  1821. */
  1822. size(collection: object | string | null | undefined): number;
  1823. }
  1824. interface LoDashImplicitWrapper<TValue> {
  1825. /**
  1826. * @see _.size
  1827. */
  1828. size(): number;
  1829. }
  1830. interface LoDashExplicitWrapper<TValue> {
  1831. /**
  1832. * @see _.size
  1833. */
  1834. size(): PrimitiveChain<number>;
  1835. }
  1836. interface LoDashStatic {
  1837. /**
  1838. * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate
  1839. * returns truthy. The predicate is invoked with three arguments: (value, index|key, collection).
  1840. *
  1841. * @param collection The collection to iterate over.
  1842. * @param predicate The function invoked per iteration.
  1843. * @return Returns true if any element passes the predicate check, else false.
  1844. */
  1845. some<T>(collection: List<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>): boolean;
  1846. /**
  1847. * @see _.some
  1848. */
  1849. some<T extends object>(collection: T | null | undefined, predicate?: ObjectIterateeCustom<T, boolean>): boolean;
  1850. }
  1851. interface Collection<T> {
  1852. /**
  1853. * @see _.some
  1854. */
  1855. some(predicate?: ListIterateeCustom<T, boolean>): boolean;
  1856. }
  1857. interface Object<T> {
  1858. /**
  1859. * @see _.some
  1860. */
  1861. some(predicate?: ObjectIterateeCustom<T, boolean>): boolean;
  1862. }
  1863. interface CollectionChain<T> {
  1864. /**
  1865. * @see _.some
  1866. */
  1867. some(predicate?: ListIterateeCustom<T, boolean>): PrimitiveChain<boolean>;
  1868. }
  1869. interface ObjectChain<T> {
  1870. /**
  1871. * @see _.some
  1872. */
  1873. some(predicate?: ObjectIterateeCustom<T, boolean>): PrimitiveChain<boolean>;
  1874. }
  1875. interface LoDashStatic {
  1876. /**
  1877. * Creates an array of elements, sorted in ascending order by the results of
  1878. * running each element in a collection through each iteratee. This method
  1879. * performs a stable sort, that is, it preserves the original sort order of
  1880. * equal elements. The iteratees are invoked with one argument: (value).
  1881. *
  1882. * @category Collection
  1883. * @param collection The collection to iterate over.
  1884. * @param [iteratees=[_.identity]]
  1885. * The iteratees to sort by, specified individually or in arrays.
  1886. * @returns Returns the new sorted array.
  1887. * @example
  1888. *
  1889. * var users = [
  1890. * { 'user': 'fred', 'age': 48 },
  1891. * { 'user': 'barney', 'age': 36 },
  1892. * { 'user': 'fred', 'age': 42 },
  1893. * { 'user': 'barney', 'age': 34 }
  1894. * ];
  1895. *
  1896. * _.sortBy(users, function(o) { return o.user; });
  1897. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
  1898. *
  1899. * _.sortBy(users, ['user', 'age']);
  1900. * // => objects for [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]]
  1901. *
  1902. * _.sortBy(users, 'user', function(o) {
  1903. * return Math.floor(o.age / 10);
  1904. * });
  1905. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
  1906. */
  1907. sortBy<T>(collection: List<T> | null | undefined, ...iteratees: Array<Many<ListIteratee<T>>>): T[];
  1908. /**
  1909. * @see _.sortBy
  1910. */
  1911. sortBy<T extends object>(collection: T | null | undefined, ...iteratees: Array<Many<ObjectIteratee<T>>>): Array<T[keyof T]>;
  1912. }
  1913. interface Collection<T> {
  1914. /**
  1915. * @see _.sortBy
  1916. */
  1917. sortBy(...iteratees: Array<Many<ListIteratee<T>>>): Collection<T>;
  1918. }
  1919. interface Object<T> {
  1920. /**
  1921. * @see _.sortBy
  1922. */
  1923. sortBy(...iteratees: Array<Many<ObjectIteratee<T>>>): Collection<T[keyof T]>;
  1924. }
  1925. interface CollectionChain<T> {
  1926. /**
  1927. * @see _.sortBy
  1928. */
  1929. sortBy(...iteratees: Array<Many<ListIteratee<T>>>): CollectionChain<T>;
  1930. }
  1931. interface ObjectChain<T> {
  1932. /**
  1933. * @see _.sortBy
  1934. */
  1935. sortBy(...iteratees: Array<Many<ObjectIteratee<T>>>): CollectionChain<T[keyof T]>;
  1936. }
  1937. }