rubico 2.3.0 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (423) hide show
  1. package/AggregateReducer.d.ts +10 -0
  2. package/README.md +9 -0
  3. package/Transducer.d.ts +231 -0
  4. package/__.d.ts +2 -0
  5. package/_internal/EmptyMap.d.ts +2 -0
  6. package/_internal/arrayFind.d.ts +15 -0
  7. package/_internal/arrayMapSeries.js +4 -4
  8. package/_internal/asyncIteratorFind.d.ts +12 -0
  9. package/_internal/findAllFilePaths.js +2 -4
  10. package/_internal/iteratorFind.d.ts +12 -0
  11. package/_internal/thunkify5.d.ts +20 -0
  12. package/_internal/timeInLoop.d.ts +25 -0
  13. package/_internal/timeInLoopAsync.d.ts +23 -0
  14. package/all.d.ts +100 -0
  15. package/always.d.ts +2 -0
  16. package/and.d.ts +45 -0
  17. package/assign.d.ts +46 -0
  18. package/compose.d.ts +25 -0
  19. package/curry.d.ts +70 -0
  20. package/dist/Transducer.es.js +2 -2
  21. package/dist/Transducer.es.min.js +2 -2
  22. package/dist/Transducer.js +2 -2
  23. package/dist/Transducer.min.js +2 -2
  24. package/dist/Transducer.mjs +2 -2
  25. package/dist/__.es.js +2 -2
  26. package/dist/__.es.min.js +2 -2
  27. package/dist/__.js +2 -2
  28. package/dist/__.min.js +2 -2
  29. package/dist/__.mjs +2 -2
  30. package/dist/all.es.js +2 -2
  31. package/dist/all.es.min.js +2 -2
  32. package/dist/all.js +2 -2
  33. package/dist/all.min.js +2 -2
  34. package/dist/all.mjs +2 -2
  35. package/dist/always.es.js +2 -2
  36. package/dist/always.es.min.js +2 -2
  37. package/dist/always.js +2 -2
  38. package/dist/always.min.js +2 -2
  39. package/dist/always.mjs +2 -2
  40. package/dist/and.es.js +2 -2
  41. package/dist/and.es.min.js +2 -2
  42. package/dist/and.js +2 -2
  43. package/dist/and.min.js +2 -2
  44. package/dist/and.mjs +2 -2
  45. package/dist/assign.es.js +2 -2
  46. package/dist/assign.es.min.js +2 -2
  47. package/dist/assign.js +2 -2
  48. package/dist/assign.min.js +2 -2
  49. package/dist/assign.mjs +2 -2
  50. package/dist/compose.es.js +2 -2
  51. package/dist/compose.es.min.js +2 -2
  52. package/dist/compose.js +2 -2
  53. package/dist/compose.min.js +2 -2
  54. package/dist/compose.mjs +2 -2
  55. package/dist/curry.es.js +2 -2
  56. package/dist/curry.es.min.js +2 -2
  57. package/dist/curry.js +2 -2
  58. package/dist/curry.min.js +2 -2
  59. package/dist/curry.mjs +2 -2
  60. package/dist/eq.es.js +2 -2
  61. package/dist/eq.es.min.js +2 -2
  62. package/dist/eq.js +2 -2
  63. package/dist/eq.min.js +2 -2
  64. package/dist/eq.mjs +2 -2
  65. package/dist/every.es.js +2 -2
  66. package/dist/every.es.min.js +2 -2
  67. package/dist/every.js +2 -2
  68. package/dist/every.min.js +2 -2
  69. package/dist/every.mjs +2 -2
  70. package/dist/filter.es.js +2 -2
  71. package/dist/filter.es.min.js +2 -2
  72. package/dist/filter.js +2 -2
  73. package/dist/filter.min.js +2 -2
  74. package/dist/filter.mjs +2 -2
  75. package/dist/flatMap.es.js +2 -2
  76. package/dist/flatMap.es.min.js +2 -2
  77. package/dist/flatMap.js +2 -2
  78. package/dist/flatMap.min.js +2 -2
  79. package/dist/flatMap.mjs +2 -2
  80. package/dist/forEach.es.js +2 -2
  81. package/dist/forEach.es.min.js +2 -2
  82. package/dist/forEach.js +2 -2
  83. package/dist/forEach.min.js +2 -2
  84. package/dist/forEach.mjs +2 -2
  85. package/dist/get.es.js +6 -6
  86. package/dist/get.es.min.js +3 -3
  87. package/dist/get.js +6 -6
  88. package/dist/get.min.js +3 -3
  89. package/dist/get.mjs +6 -6
  90. package/dist/gt.es.js +2 -2
  91. package/dist/gt.es.min.js +2 -2
  92. package/dist/gt.js +2 -2
  93. package/dist/gt.min.js +2 -2
  94. package/dist/gt.mjs +2 -2
  95. package/dist/gte.es.js +2 -2
  96. package/dist/gte.es.min.js +2 -2
  97. package/dist/gte.js +2 -2
  98. package/dist/gte.min.js +2 -2
  99. package/dist/gte.mjs +2 -2
  100. package/dist/lt.es.js +2 -2
  101. package/dist/lt.es.min.js +2 -2
  102. package/dist/lt.js +2 -2
  103. package/dist/lt.min.js +2 -2
  104. package/dist/lt.mjs +2 -2
  105. package/dist/lte.es.js +2 -2
  106. package/dist/lte.es.min.js +2 -2
  107. package/dist/lte.js +2 -2
  108. package/dist/lte.min.js +2 -2
  109. package/dist/lte.mjs +2 -2
  110. package/dist/map.es.js +4 -4
  111. package/dist/map.es.min.js +3 -3
  112. package/dist/map.js +4 -4
  113. package/dist/map.min.js +3 -3
  114. package/dist/map.mjs +4 -4
  115. package/dist/not.es.js +2 -2
  116. package/dist/not.es.min.js +2 -2
  117. package/dist/not.js +2 -2
  118. package/dist/not.min.js +2 -2
  119. package/dist/not.mjs +2 -2
  120. package/dist/omit.es.js +2 -2
  121. package/dist/omit.es.min.js +2 -2
  122. package/dist/omit.js +2 -2
  123. package/dist/omit.min.js +2 -2
  124. package/dist/omit.mjs +2 -2
  125. package/dist/or.es.js +2 -2
  126. package/dist/or.es.min.js +2 -2
  127. package/dist/or.js +2 -2
  128. package/dist/or.min.js +2 -2
  129. package/dist/or.mjs +2 -2
  130. package/dist/pick.es.js +2 -2
  131. package/dist/pick.es.min.js +2 -2
  132. package/dist/pick.js +2 -2
  133. package/dist/pick.min.js +2 -2
  134. package/dist/pick.mjs +2 -2
  135. package/dist/pipe.es.js +2 -2
  136. package/dist/pipe.es.min.js +2 -2
  137. package/dist/pipe.js +2 -2
  138. package/dist/pipe.min.js +2 -2
  139. package/dist/pipe.mjs +2 -2
  140. package/dist/reduce.es.js +2 -2
  141. package/dist/reduce.es.min.js +2 -2
  142. package/dist/reduce.js +2 -2
  143. package/dist/reduce.min.js +2 -2
  144. package/dist/reduce.mjs +2 -2
  145. package/dist/rubico.es.js +8 -8
  146. package/dist/rubico.es.min.js +3 -3
  147. package/dist/rubico.global.js +8 -8
  148. package/dist/rubico.global.min.js +3 -3
  149. package/dist/rubico.js +8 -8
  150. package/dist/rubico.min.js +3 -3
  151. package/dist/rubico.mjs +8 -8
  152. package/dist/set.es.js +2 -2
  153. package/dist/set.es.min.js +2 -2
  154. package/dist/set.js +2 -2
  155. package/dist/set.min.js +2 -2
  156. package/dist/set.mjs +2 -2
  157. package/dist/some.es.js +2 -2
  158. package/dist/some.es.min.js +2 -2
  159. package/dist/some.js +2 -2
  160. package/dist/some.min.js +2 -2
  161. package/dist/some.mjs +2 -2
  162. package/dist/switchCase.es.js +2 -2
  163. package/dist/switchCase.es.min.js +2 -2
  164. package/dist/switchCase.js +2 -2
  165. package/dist/switchCase.min.js +2 -2
  166. package/dist/switchCase.mjs +2 -2
  167. package/dist/tap.es.js +2 -2
  168. package/dist/tap.es.min.js +2 -2
  169. package/dist/tap.js +2 -2
  170. package/dist/tap.min.js +2 -2
  171. package/dist/tap.mjs +2 -2
  172. package/dist/thunkify.es.js +2 -2
  173. package/dist/thunkify.es.min.js +2 -2
  174. package/dist/thunkify.js +2 -2
  175. package/dist/thunkify.min.js +2 -2
  176. package/dist/thunkify.mjs +2 -2
  177. package/dist/transform.es.js +2 -2
  178. package/dist/transform.es.min.js +2 -2
  179. package/dist/transform.js +2 -2
  180. package/dist/transform.min.js +2 -2
  181. package/dist/transform.mjs +2 -2
  182. package/dist/tryCatch.es.js +2 -2
  183. package/dist/tryCatch.es.min.js +2 -2
  184. package/dist/tryCatch.js +2 -2
  185. package/dist/tryCatch.min.js +2 -2
  186. package/dist/tryCatch.mjs +2 -2
  187. package/dist/x/append.es.js +2 -2
  188. package/dist/x/append.es.min.js +2 -2
  189. package/dist/x/append.js +2 -2
  190. package/dist/x/append.min.js +2 -2
  191. package/dist/x/append.mjs +2 -2
  192. package/dist/x/callProp.es.js +2 -2
  193. package/dist/x/callProp.es.min.js +2 -2
  194. package/dist/x/callProp.js +2 -2
  195. package/dist/x/callProp.min.js +2 -2
  196. package/dist/x/callProp.mjs +2 -2
  197. package/dist/x/defaultsDeep.es.js +2 -2
  198. package/dist/x/defaultsDeep.es.min.js +2 -2
  199. package/dist/x/defaultsDeep.js +2 -2
  200. package/dist/x/defaultsDeep.min.js +2 -2
  201. package/dist/x/defaultsDeep.mjs +2 -2
  202. package/dist/x/differenceWith.es.js +2 -2
  203. package/dist/x/differenceWith.es.min.js +2 -2
  204. package/dist/x/differenceWith.js +2 -2
  205. package/dist/x/differenceWith.min.js +2 -2
  206. package/dist/x/differenceWith.mjs +2 -2
  207. package/dist/x/filterOut.es.js +2 -2
  208. package/dist/x/filterOut.es.min.js +2 -2
  209. package/dist/x/filterOut.js +2 -2
  210. package/dist/x/filterOut.min.js +2 -2
  211. package/dist/x/filterOut.mjs +2 -2
  212. package/dist/x/find.es.js +2 -2
  213. package/dist/x/find.es.min.js +2 -2
  214. package/dist/x/find.js +2 -2
  215. package/dist/x/find.min.js +2 -2
  216. package/dist/x/find.mjs +2 -2
  217. package/dist/x/findIndex.es.js +2 -2
  218. package/dist/x/findIndex.es.min.js +2 -2
  219. package/dist/x/findIndex.js +2 -2
  220. package/dist/x/findIndex.min.js +2 -2
  221. package/dist/x/findIndex.mjs +2 -2
  222. package/dist/x/first.es.js +2 -2
  223. package/dist/x/first.es.min.js +2 -2
  224. package/dist/x/first.js +2 -2
  225. package/dist/x/first.min.js +2 -2
  226. package/dist/x/first.mjs +2 -2
  227. package/dist/x/flatten.es.js +2 -2
  228. package/dist/x/flatten.es.min.js +2 -2
  229. package/dist/x/flatten.js +2 -2
  230. package/dist/x/flatten.min.js +2 -2
  231. package/dist/x/flatten.mjs +2 -2
  232. package/dist/x/groupBy.es.js +2 -2
  233. package/dist/x/groupBy.es.min.js +2 -2
  234. package/dist/x/groupBy.js +2 -2
  235. package/dist/x/groupBy.min.js +2 -2
  236. package/dist/x/groupBy.mjs +2 -2
  237. package/dist/x/has.es.js +2 -2
  238. package/dist/x/has.es.min.js +2 -2
  239. package/dist/x/has.js +2 -2
  240. package/dist/x/has.min.js +2 -2
  241. package/dist/x/has.mjs +2 -2
  242. package/dist/x/identity.es.js +2 -2
  243. package/dist/x/identity.es.min.js +2 -2
  244. package/dist/x/identity.js +2 -2
  245. package/dist/x/identity.min.js +2 -2
  246. package/dist/x/identity.mjs +2 -2
  247. package/dist/x/includes.es.js +2 -2
  248. package/dist/x/includes.es.min.js +2 -2
  249. package/dist/x/includes.js +2 -2
  250. package/dist/x/includes.min.js +2 -2
  251. package/dist/x/includes.mjs +2 -2
  252. package/dist/x/isDeepEqual.es.js +2 -2
  253. package/dist/x/isDeepEqual.es.min.js +2 -2
  254. package/dist/x/isDeepEqual.js +2 -2
  255. package/dist/x/isDeepEqual.min.js +2 -2
  256. package/dist/x/isDeepEqual.mjs +2 -2
  257. package/dist/x/isEmpty.es.js +2 -2
  258. package/dist/x/isEmpty.es.min.js +2 -2
  259. package/dist/x/isEmpty.js +2 -2
  260. package/dist/x/isEmpty.min.js +2 -2
  261. package/dist/x/isEmpty.mjs +2 -2
  262. package/dist/x/isEqual.es.js +2 -2
  263. package/dist/x/isEqual.es.min.js +2 -2
  264. package/dist/x/isEqual.js +2 -2
  265. package/dist/x/isEqual.min.js +2 -2
  266. package/dist/x/isEqual.mjs +2 -2
  267. package/dist/x/isFunction.es.js +2 -2
  268. package/dist/x/isFunction.es.min.js +2 -2
  269. package/dist/x/isFunction.js +2 -2
  270. package/dist/x/isFunction.min.js +2 -2
  271. package/dist/x/isFunction.mjs +2 -2
  272. package/dist/x/isIn.es.js +2 -2
  273. package/dist/x/isIn.es.min.js +2 -2
  274. package/dist/x/isIn.js +2 -2
  275. package/dist/x/isIn.min.js +2 -2
  276. package/dist/x/isIn.mjs +2 -2
  277. package/dist/x/isObject.es.js +2 -2
  278. package/dist/x/isObject.es.min.js +2 -2
  279. package/dist/x/isObject.js +2 -2
  280. package/dist/x/isObject.min.js +2 -2
  281. package/dist/x/isObject.mjs +2 -2
  282. package/dist/x/isString.es.js +2 -2
  283. package/dist/x/isString.es.min.js +2 -2
  284. package/dist/x/isString.js +2 -2
  285. package/dist/x/isString.min.js +2 -2
  286. package/dist/x/isString.mjs +2 -2
  287. package/dist/x/keys.es.js +2 -2
  288. package/dist/x/keys.es.min.js +2 -2
  289. package/dist/x/keys.js +2 -2
  290. package/dist/x/keys.min.js +2 -2
  291. package/dist/x/keys.mjs +2 -2
  292. package/dist/x/last.es.js +2 -2
  293. package/dist/x/last.es.min.js +2 -2
  294. package/dist/x/last.js +2 -2
  295. package/dist/x/last.min.js +2 -2
  296. package/dist/x/last.mjs +2 -2
  297. package/dist/x/maxBy.es.js +6 -6
  298. package/dist/x/maxBy.es.min.js +3 -3
  299. package/dist/x/maxBy.js +6 -6
  300. package/dist/x/maxBy.min.js +3 -3
  301. package/dist/x/maxBy.mjs +6 -6
  302. package/dist/x/noop.es.js +2 -2
  303. package/dist/x/noop.es.min.js +2 -2
  304. package/dist/x/noop.js +2 -2
  305. package/dist/x/noop.min.js +2 -2
  306. package/dist/x/noop.mjs +2 -2
  307. package/dist/x/pluck.es.js +8 -8
  308. package/dist/x/pluck.es.min.js +3 -3
  309. package/dist/x/pluck.js +8 -8
  310. package/dist/x/pluck.min.js +3 -3
  311. package/dist/x/pluck.mjs +8 -8
  312. package/dist/x/prepend.es.js +2 -2
  313. package/dist/x/prepend.es.min.js +2 -2
  314. package/dist/x/prepend.js +2 -2
  315. package/dist/x/prepend.min.js +2 -2
  316. package/dist/x/prepend.mjs +2 -2
  317. package/dist/x/size.es.js +2 -2
  318. package/dist/x/size.es.min.js +2 -2
  319. package/dist/x/size.js +2 -2
  320. package/dist/x/size.min.js +2 -2
  321. package/dist/x/size.mjs +2 -2
  322. package/dist/x/trace.es.js +2 -2
  323. package/dist/x/trace.es.min.js +2 -2
  324. package/dist/x/trace.js +2 -2
  325. package/dist/x/trace.min.js +2 -2
  326. package/dist/x/trace.mjs +2 -2
  327. package/dist/x/unionWith.es.js +2 -2
  328. package/dist/x/unionWith.es.min.js +2 -2
  329. package/dist/x/unionWith.js +2 -2
  330. package/dist/x/unionWith.min.js +2 -2
  331. package/dist/x/unionWith.mjs +2 -2
  332. package/dist/x/uniq.es.js +2 -2
  333. package/dist/x/uniq.es.min.js +2 -2
  334. package/dist/x/uniq.js +2 -2
  335. package/dist/x/uniq.min.js +2 -2
  336. package/dist/x/uniq.mjs +2 -2
  337. package/dist/x/unless.es.js +2 -2
  338. package/dist/x/unless.es.min.js +2 -2
  339. package/dist/x/unless.js +2 -2
  340. package/dist/x/unless.min.js +2 -2
  341. package/dist/x/unless.mjs +2 -2
  342. package/dist/x/values.es.js +2 -2
  343. package/dist/x/values.es.min.js +2 -2
  344. package/dist/x/values.js +2 -2
  345. package/dist/x/values.min.js +2 -2
  346. package/dist/x/values.mjs +2 -2
  347. package/dist/x/when.es.js +2 -2
  348. package/dist/x/when.es.min.js +2 -2
  349. package/dist/x/when.js +2 -2
  350. package/dist/x/when.min.js +2 -2
  351. package/dist/x/when.mjs +2 -2
  352. package/eq.d.ts +51 -0
  353. package/es.d.ts +80 -0
  354. package/es.js +8 -8
  355. package/every.d.ts +52 -0
  356. package/filter.d.ts +148 -0
  357. package/flatMap.d.ts +109 -0
  358. package/forEach.d.ts +35 -0
  359. package/get.d.ts +70 -0
  360. package/get.js +4 -4
  361. package/global.d.ts +1 -0
  362. package/gt.d.ts +49 -0
  363. package/gte.d.ts +51 -0
  364. package/index.d.ts +1 -0
  365. package/index.js +8 -8
  366. package/lt.d.ts +49 -0
  367. package/lte.d.ts +49 -0
  368. package/map.d.ts +246 -0
  369. package/monad/Instance.d.ts +246 -0
  370. package/monad/Instance.js +188 -206
  371. package/not.d.ts +34 -0
  372. package/omit.d.ts +50 -0
  373. package/or.d.ts +43 -0
  374. package/package.json +41 -4
  375. package/pick.d.ts +43 -0
  376. package/pipe.d.ts +49 -0
  377. package/reduce.d.ts +166 -0
  378. package/set.d.ts +61 -0
  379. package/some.d.ts +65 -0
  380. package/switchCase.d.ts +76 -0
  381. package/tap.d.ts +53 -0
  382. package/thunkify.d.ts +21 -0
  383. package/transform.d.ts +131 -0
  384. package/tryCatch.d.ts +47 -0
  385. package/x/append.d.ts +38 -0
  386. package/x/callProp.d.ts +20 -0
  387. package/x/defaultsDeep.d.ts +42 -0
  388. package/x/differenceWith.d.ts +25 -0
  389. package/x/filterOut.d.ts +39 -0
  390. package/x/find.d.ts +34 -0
  391. package/x/findIndex.d.ts +25 -0
  392. package/x/first.d.ts +23 -0
  393. package/x/flatten.d.ts +57 -0
  394. package/x/groupBy.d.ts +50 -0
  395. package/x/has.d.ts +25 -0
  396. package/x/heapUsedInLoop.d.ts +53 -0
  397. package/x/identity.d.ts +21 -0
  398. package/x/includes.d.ts +25 -0
  399. package/x/index.d.ts +34 -0
  400. package/x/is.d.ts +2 -0
  401. package/x/isEmpty.d.ts +24 -0
  402. package/x/isEqual.d.ts +2 -0
  403. package/x/isFunction.d.ts +23 -0
  404. package/x/isIn.d.ts +61 -0
  405. package/x/isObject.d.ts +2 -0
  406. package/x/isString.benchmarks.d.ts +1 -0
  407. package/x/isString.d.ts +21 -0
  408. package/x/keys.d.ts +23 -0
  409. package/x/last.d.ts +22 -0
  410. package/x/maxBy.d.ts +41 -0
  411. package/x/noop.d.ts +21 -0
  412. package/x/pluck.d.ts +35 -0
  413. package/x/prepend.d.ts +38 -0
  414. package/x/size.d.ts +21 -0
  415. package/x/test.d.ts +1 -0
  416. package/x/timeInLoop.d.ts +21 -0
  417. package/x/trace.d.ts +30 -0
  418. package/x/tracef.d.ts +7 -0
  419. package/x/unionWith.d.ts +31 -0
  420. package/x/uniq.d.ts +24 -0
  421. package/x/unless.d.ts +28 -0
  422. package/x/values.d.ts +23 -0
  423. package/x/when.d.ts +28 -0
@@ -0,0 +1,10 @@
1
+ export = AggregateReducer;
2
+ /**
3
+ * @name AggregateReducer
4
+ *
5
+ * @synopsis
6
+ * ```coffeescript [specscript]
7
+ * AggregateReducer(reducers Array<reducer function>) -> aggregateReducer function
8
+ * ```
9
+ */
10
+ declare function AggregateReducer(reducers: any): any;
package/README.md CHANGED
@@ -250,3 +250,12 @@ rubico is [MIT Licensed](https://github.com/a-synchronous/rubico/blob/master/LIC
250
250
  * minimum Firefox version: 57
251
251
  * minimum Edge version: 79
252
252
  * minimum Safari version: 11.1
253
+
254
+ # Awesome Resources
255
+ [rubico simplifies asynchronous code](https://dev.to/richytong/rubico-a-synchrnous-functional-syntax-motivation-20hf)
256
+ <br>
257
+ [Practical Functional Programming in JavaScript - Error Handling](https://dev.to/richytong/practical-functional-programming-in-javascript-error-handling-8g5)
258
+ <br>
259
+ [Practical Functional Programming in JavaScript - Techniques for Composing Data](https://dev.to/richytong/practical-functional-programming-in-javascript-techniques-for-composing-data-c39)
260
+ <br>
261
+ [Practical Functional Programming in JavaScript - Side Effects and Purity](https://dev.to/richytong/practical-functional-programming-in-javascript-side-effects-and-purity-revised-420h)
@@ -0,0 +1,231 @@
1
+ /**
2
+ * @name Transducer.map
3
+ *
4
+ * @synopsis
5
+ * ```coffeescript [specscript]
6
+ * type Reducer = (
7
+ * accumulator any,
8
+ * value any,
9
+ * indexOrKey? number|string,
10
+ * collection? Foldable,
11
+ * )=>(nextAccumulator Promise|any)
12
+ *
13
+ * type Transducer = Reducer=>Reducer
14
+ *
15
+ * Transducer.map(mapperFunc function) -> mappingTransducer Transducer
16
+ * ```
17
+ *
18
+ * @description
19
+ * Creates a mapping transducer. Items in the final reducing operation are transformed by the mapper function. It is possible to use an asynchronous mapper, however the reducing operation must support asynchronous execution. This library provides such implementations as [reduce](/docs/reduce) and [transform](/docs/transform).
20
+ *
21
+ * ```javascript [playground]
22
+ * const square = number => number ** 2
23
+ *
24
+ * const concat = (array, item) => array.concat(item)
25
+ *
26
+ * const mapSquare = Transducer.map(square)
27
+ * // mapSquare is a transducer
28
+ *
29
+ * const squareConcatReducer = mapSquare(concat)
30
+ * // now mapSquare is passed the reducer function concat; squareConcatReducer
31
+ * // is a reducer with chained functionality square and concat
32
+ *
33
+ * console.log(
34
+ * reduce([1, 2, 3, 4, 5], squareConcatReducer, [])
35
+ * ) // [1, 4, 9, 16, 25]
36
+ *
37
+ * // the same squareConcatReducer is consumable with vanilla JavaScript
38
+ * console.log(
39
+ * [1, 2, 3, 4, 5].reduce(squareConcatReducer, [])
40
+ * ) // [1, 4, 9, 16, 25]
41
+ *
42
+ * // concat is implicit when transforming into arrays
43
+ * console.log(
44
+ * transform([1, 2, 3, 4, 5], Transducer.map(square), [])
45
+ * ) // [1, 4, 9, 16, 25]
46
+ * ```
47
+ *
48
+ * Read more on transducers [here](/blog/transducers-crash-course-rubico-v2).
49
+ */
50
+ export function map(mapper: any): (arg0: any) => any;
51
+ /**
52
+ * @name Transducer.filter
53
+ *
54
+ * @synopsis
55
+ * ```coffeescript [specscript]
56
+ * type Reducer = (
57
+ * accumulator any,
58
+ * value any,
59
+ * indexOrKey? number|string,
60
+ * collection? Foldable,
61
+ * )=>(nextAccumulator Promise|any)
62
+ *
63
+ * type Transducer = Reducer=>Reducer
64
+ *
65
+ * Transducer.filter(predicate function) -> filteringTransducer Transducer
66
+ * ```
67
+ *
68
+ * @description
69
+ * Creates a filtering transducer. A filtering reducer skips items of reducing operation if they test falsy by the predicate. It is possible to use an asynchronous predicate, however the reducing operation must support asynchronous execution. This library provides such implementations as [reduce](/docs/reduce) and [transform](/docs/transform).
70
+ *
71
+ * ```javascript [playground]
72
+ * const isOdd = number => number % 2 == 1
73
+ *
74
+ * const concat = (array, item) => array.concat(item)
75
+ *
76
+ * const concatOddNumbers = filter(isOdd)(concat)
77
+ *
78
+ * console.log(
79
+ * [1, 2, 3, 4, 5].reduce(concatOddNumbers, []),
80
+ * ) // [1, 3, 5]
81
+ * ```
82
+ */
83
+ export function filter(predicate: any): (arg0: any) => any;
84
+ /**
85
+ * @name Transducer.flatMap
86
+ *
87
+ * @synopsis
88
+ * ```coffeescript [specscript]
89
+ * type Reducer = (
90
+ * accumulator any,
91
+ * value any,
92
+ * indexOrKey? number|string,
93
+ * collection? Foldable,
94
+ * )=>(nextAccumulator Promise|any)
95
+ *
96
+ * type Transducer = Reducer=>Reducer
97
+ *
98
+ * Transducer.flatMap(flatMapper) -> flatMappingTransducer Transducer
99
+ * ```
100
+ *
101
+ * @description
102
+ * Creates a flatMapping transducer. A flatMapping transducer applies the flatMapping function to each item of the reducing operation, concatenating the results of the flatMapper execution into the final result. It is possible to use an asynchronous flatMapper, however the reducing operation must support asynchronous execution. This library provides such implementations as [reduce](/docs/reduce) and [transform](/docs/transform).
103
+ *
104
+ * ```javascript [playground]
105
+ * const powers = number => [number, number ** 2, number ** 3]
106
+ *
107
+ * const numbers = [1, 2, 3, 4, 5]
108
+ *
109
+ * console.log(
110
+ * transform(numbers, Transducer.flatMap(powers), [])
111
+ * ) // [1, 1, 1, 2, 4, 8, 3, 9, 27, 4, 16, 64, 5, 25, 125]
112
+ * ```
113
+ *
114
+ * Read more on transducers [here](/blog/transducers-crash-course-rubico-v2).
115
+ */
116
+ export function flatMap(flatMapper: any): (arg0: any) => any;
117
+ /**
118
+ * @name Transducer.forEach
119
+ *
120
+ * @synopsis
121
+ * ```coffeescript [specscript]
122
+ * type Reducer = (
123
+ * accumulator any,
124
+ * value any,
125
+ * indexOrKey? number|string,
126
+ * collection? Foldable,
127
+ * )=>(nextAccumulator Promise|any)
128
+ *
129
+ * type Transducer = Reducer=>Reducer
130
+ *
131
+ * Transducer.forEach(func function) -> forEachTransducer Transducer
132
+ * ```
133
+ *
134
+ * @description
135
+ * Creates an effectful pasthrough transducer. The effectful passthrough transducer applies the effectful function to each item of the reducing operation, leaving the reducing operation unchanged. It is possible to use an asynchronous effectful function, however the reducing operation must support asynchronous execution. This library provides such implementations as [reduce](/docs/reduce) and [transform](/docs/transform).
136
+ *
137
+ * ```javascript [playground]
138
+ * const numbers = [1, 2, 3, 4, 5]
139
+ * transform(numbers, compose([
140
+ * Transducer.map(number => number ** 2),
141
+ * Transducer.forEach(console.log), // 1 4 9 16 25
142
+ * ]), null)
143
+ * ```
144
+ */
145
+ export function forEach(func: any): (arg0: any) => any;
146
+ /**
147
+ * @name Transducer.passthrough
148
+ *
149
+ * @synopsis
150
+ * ```coffeescript [specscript]
151
+ * type Reducer = (
152
+ * accumulator any,
153
+ * value any,
154
+ * indexOrKey? number|string,
155
+ * collection? Foldable,
156
+ * )=>(nextAccumulator Promise|any)
157
+ *
158
+ * type Transducer = Reducer=>Reducer
159
+ *
160
+ * Transducer.passthrough(func function) -> passthroughTransducer Transducer
161
+ * ```
162
+ *
163
+ * @description
164
+ * Creates a pasthrough transducer. The passthrough transducer passes each item of the reducing operation through, leaving the reducing operation unchanged.
165
+ *
166
+ * ```javascript [playground]
167
+ * const createAsyncNumbers = async function* () {
168
+ * let number = 0
169
+ * while (number < 10) {
170
+ * yield number
171
+ * number += 1
172
+ * }
173
+ * }
174
+ *
175
+ * transform(createAsyncNumbers(), Transducer.passthrough, [])
176
+ * .then(console.log) // [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
177
+ * ```
178
+ */
179
+ export function passthrough(reducer: any): any;
180
+ /**
181
+ * @name Transducer.tryCatch
182
+ *
183
+ * @synopsis
184
+ * ```coffeescript [specscript]
185
+ * type Reducer = (
186
+ * accumulator any,
187
+ * item any,
188
+ * indexOrKey? number|string,
189
+ * collection? Foldable,
190
+ * )=>(nextAccumulator Promise|any)
191
+ *
192
+ * type Transducer = Reducer=>Reducer
193
+ *
194
+ * Transducer.tryCatch(
195
+ * transducerTryer Transducer,
196
+ * catcher (error Error, item any)=>Promise|any,
197
+ * ) -> tryCatchTransducer Transducer
198
+ * ```
199
+ *
200
+ * @description
201
+ * Creates an error handling transducer. The error handling transducer wraps a transducer and catches any errors thrown by the transducer with the catcher function. The catcher function is provided the error as well as the original item (before any processing by the transducer) for which the error was thrown. It is possible for either the transducer or the catcher to be asynchronous, however the reducing operation must support asynchronous execution. This library provides such implementations as [reduce](/docs/reduce) and [transform](/docs/transform).
202
+ *
203
+ * ```javascript [playground]
204
+ * const db = new Map()
205
+ * db.set('a', { id: 'a', name: 'George' })
206
+ * db.set('b', { id: 'b', name: 'Jane' })
207
+ * db.set('c', { id: 'c', name: 'Jill' })
208
+ * db.set('e', { id: 'e', name: 'Jim' })
209
+ *
210
+ * const userIds = ['a', 'b', 'c', 'd', 'e']
211
+ *
212
+ * transform(userIds, Transducer.tryCatch(compose([
213
+ * Transducer.map(async userId => {
214
+ * if (db.has(userId)) {
215
+ * return db.get(userId)
216
+ * }
217
+ * throw new Error(`user ${userId} not found`)
218
+ * }),
219
+ *
220
+ * Transducer.forEach(user => {
221
+ * console.log('Found', user.name)
222
+ * })
223
+ * ]), (error, userId) => {
224
+ * console.error(error)
225
+ * console.log('userId in catcher:', userId)
226
+ * // original userId for which the error was thrown is provided
227
+ * }), null)
228
+ * ```
229
+
230
+ */
231
+ export function tryCatch(transducerTryer: any, catcher: any): (arg0: any) => any;
package/__.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export = __;
2
+ import __ = require("./_internal/placeholder");
@@ -0,0 +1,2 @@
1
+ export = EmptyMap;
2
+ declare function EmptyMap(): any;
@@ -0,0 +1,15 @@
1
+ export = arrayFind;
2
+ /**
3
+ * @name arrayFind
4
+ *
5
+ * @synopsis
6
+ * ```coffeescript [specscript]
7
+ * var T any,
8
+ * array Array<T>,
9
+ * predicate T=>Promise|boolean,
10
+ * result Promise|T|undefined
11
+ *
12
+ * arrayFind(array, predicate) -> result
13
+ * ```
14
+ */
15
+ declare function arrayFind(array: any, predicate: any): any;
@@ -13,7 +13,7 @@ const objectSet = require('./objectSet')
13
13
  * arrayMapSeriesAsync<
14
14
  * T any,
15
15
  * array Array<T>,
16
- * mapper T=>Promise|any,
16
+ * mapper (T,index)=>Promise|any,
17
17
  * result Array,
18
18
  * index number,
19
19
  * >(array, mapper, result Array, index) -> Promise|result
@@ -27,7 +27,7 @@ const arrayMapSeriesAsync = async function (
27
27
  ) {
28
28
  const arrayLength = array.length
29
29
  while (++index < arrayLength) {
30
- const resultItem = mapper(array[index])
30
+ const resultItem = mapper(array[index], index)
31
31
  result[index] = isPromise(resultItem) ? await resultItem : resultItem
32
32
  }
33
33
  return result
@@ -41,7 +41,7 @@ const arrayMapSeriesAsync = async function (
41
41
  * arrayMapSeries<
42
42
  * T any,
43
43
  * array Array<T>,
44
- * mapper T=>Promise|any,
44
+ * mapper (T,index)=>Promise|any,
45
45
  * >(array, mapper) -> mappedInSeries Promise|Array
46
46
  * ```
47
47
  *
@@ -54,7 +54,7 @@ const arrayMapSeries = function (array, mapper) {
54
54
  let index = -1
55
55
 
56
56
  while (++index < arrayLength) {
57
- const resultItem = mapper(array[index])
57
+ const resultItem = mapper(array[index], index)
58
58
  if (isPromise(resultItem)) {
59
59
  return resultItem.then(funcConcat(
60
60
  curry3(objectSet, result, index, __),
@@ -0,0 +1,12 @@
1
+ export = asyncIteratorFind;
2
+ /**
3
+ * @name asyncIteratorFind
4
+ *
5
+ * @synopsis
6
+ * var T any,
7
+ * asyncIterator AsyncIterator<T>,
8
+ * predicate T=>Promise|boolean
9
+ *
10
+ * asyncIteratorFind(asyncIterator, predicate) -> Promise|T|undefined
11
+ */
12
+ declare function asyncIteratorFind(asyncIterator: any, predicate: any): Promise<any>;
@@ -1,5 +1,4 @@
1
1
  const fs = require('fs')
2
- const pathResolve = require('./pathResolve')
3
2
 
4
3
  // findAllFilePaths(path string) -> filePaths Promise<Array<string>>
5
4
  const findAllFilePaths = async function (path) {
@@ -10,10 +9,9 @@ const findAllFilePaths = async function (path) {
10
9
  const result = []
11
10
  for (const file of files) {
12
11
  if (file.isDirectory()) {
13
- const filePaths = await findAllFilePaths(pathResolve(path, file.name))
14
- result.push(...filePaths)
12
+ continue
15
13
  } else {
16
- result.push(pathResolve(path, file.name))
14
+ result.push(`${file.path}/${file.name}`)
17
15
  }
18
16
  }
19
17
  return result
@@ -0,0 +1,12 @@
1
+ export = iteratorFind;
2
+ /**
3
+ * @name iteratorFind
4
+ *
5
+ * @synopsis
6
+ * var T any,
7
+ * iterator Iterator<T>,
8
+ * predicate T=>Promise|boolean
9
+ *
10
+ * iteratorFind(iterator, predicate) -> Promise|T|undefined
11
+ */
12
+ declare function iteratorFind(iterator: any, predicate: any): any;
@@ -0,0 +1,20 @@
1
+ export = thunkify5;
2
+ /**
3
+ * @name thunkify5
4
+ *
5
+ * @synopsis
6
+ * ```coffeescript [specscript]
7
+ * thunkify5<
8
+ * arg0 any,
9
+ * arg1 any,
10
+ * arg2 any,
11
+ * arg3 any,
12
+ * arg4 any,
13
+ * func (arg0, arg1, arg2, arg3, arg4)=>any,
14
+ * >(func, arg0, arg1, arg2, arg3, arg4) -> thunk ()=>func(arg0, arg1, arg2, arg3, arg4)
15
+ * ```
16
+ *
17
+ * @description
18
+ * Create a thunk from a function and five arguments.
19
+ */
20
+ declare function thunkify5(func: any, arg0: any, arg1: any, arg2: any, arg3: any, arg4: any): () => any;
@@ -0,0 +1,25 @@
1
+ export = timeInLoop;
2
+ /**
3
+ * @name timeInLoop
4
+ *
5
+ * @synopsis
6
+ * ```coffeescript [specscript]
7
+ * timeInLoop(description string, loopCount number, fn function, options? {
8
+ * silent?: boolean,
9
+ * }) -> undefined
10
+ * ```
11
+ *
12
+ * @description
13
+ * Logs the amount of time required for a function to run a certain number of times
14
+ *
15
+ * ```js
16
+ * timeInLoop('hello', 1e6, () => 'hello') // hello: 1e+6: 3.474ms
17
+ * ```
18
+ *
19
+ * Reference: https://gist.github.com/funfunction/91b5876a5f562e1e352aed0fcabc3858
20
+ */
21
+ declare function timeInLoop(description: any, loopCount: any, fn: any, options?: {}): {
22
+ description: any;
23
+ loopCount: any;
24
+ duration: number;
25
+ };
@@ -0,0 +1,23 @@
1
+ export = timeInLoopAsync;
2
+ /**
3
+ * @name timeInLoopAsync
4
+ *
5
+ * @synopsis
6
+ * ```coffeescript [specscript]
7
+ * timeInLoop.async(description string, loopCount number, fn function, options? {
8
+ * silent?: boolean,
9
+ * }) -> undefined
10
+ * ```
11
+ *
12
+ * @description
13
+ * Like timeInLoop, but every call is awaited
14
+ *
15
+ * ```js
16
+ * timeInLoop.async('async hello', 1e6, async () => 'hello') // async hello: 1e+6: 116.006ms
17
+ * ```
18
+ */
19
+ declare function timeInLoopAsync(description: any, loopCount: any, fn: any, options?: {}): Promise<{
20
+ description: any;
21
+ loopCount: any;
22
+ duration: number;
23
+ }>;
package/all.d.ts ADDED
@@ -0,0 +1,100 @@
1
+ export = all;
2
+ /**
3
+ * @name all
4
+ *
5
+ * @synopsis
6
+ * ```coffeescript [specscript]
7
+ * all(...args, funcsArray Array<function>) -> result Promise|Array
8
+ *
9
+ * all(funcsArray Array<function>)(...args) -> result Promise|Array
10
+ *
11
+ * all(...args, funcsObject Object<function>) -> result Promise|Object
12
+ *
13
+ * all(funcsObject Object<function>)(...args) -> result Promise|Object
14
+ * ```
15
+ *
16
+ * @description
17
+ * Function executor and composer. Accepts either an array of functions or an object of functions as the values. Calls each function of the provided array or object in parallel with the provided arguments. Returns either an array or object of the results of the function executions.
18
+ *
19
+ * ```javascript [playground]
20
+ * const createArrayOfGreetingsFor = all([
21
+ * name => `Hi ${name}`,
22
+ * name => `Hey ${name}`,
23
+ * name => `Hello ${name}`,
24
+ * ])
25
+ *
26
+ * const arrayOfGreetingsForFred = createArrayOfGreetingsFor('Fred')
27
+ *
28
+ * console.log(arrayOfGreetingsForFred)
29
+ * // ['Hi Fred', 'Hey Fred', 'Hello Fred']
30
+ *
31
+ * const createObjectOfGreetingsFor = all({
32
+ * hi: name => `Hi ${name}`,
33
+ * hey: name => `Hey ${name}`,
34
+ * hello: name => `Hello ${name}`,
35
+ * })
36
+ *
37
+ * const objectOfGreetingsForJane = createObjectOfGreetingsFor('Jane')
38
+ *
39
+ * console.log(objectOfGreetingsForJane)
40
+ * // { hi: 'Hi Jane', hey: 'Hey Jane', hello: 'Hello Jane' }
41
+ * ```
42
+ *
43
+ * `all` can simultaneously compose objects and handle promises.
44
+ *
45
+ * ```javascript [playground]
46
+ * const identity = value => value
47
+ *
48
+ * const userbase = new Map()
49
+ * userbase.set('1', { _id: 1, name: 'George' })
50
+ *
51
+ * const getUserByID = async id => userbase.get(id)
52
+ *
53
+ * const getAndLogUserById = pipe([
54
+ * all({
55
+ * id: identity,
56
+ * user: getUserByID,
57
+ * }),
58
+ * tap(({ id, user }) => {
59
+ * console.log(`Got user ${JSON.stringify(user)} by id ${id}`)
60
+ * }),
61
+ * ])
62
+ *
63
+ * getAndLogUserById('1') // Got user {"_id":1,"name":"George"} by id 1
64
+ * ```
65
+ *
66
+ * @execution concurrent
67
+ */
68
+ declare function all(...args: any[]): any;
69
+ declare namespace all {
70
+ /**
71
+ * @name all.series
72
+ *
73
+ * @synopsis
74
+ * ```coffeescript [specscript]
75
+ * all.series(...args, funcsArray Array<function>) -> result Promise|Array
76
+ *
77
+ * all.series(funcsArray Array<function>)(...args) -> result Promise|Array
78
+ * ```
79
+ *
80
+ * @description
81
+ * `all` with serial execution.
82
+ *
83
+ * ```javascript [playground]
84
+ * const sleep = ms => () => new Promise(resolve => setTimeout(resolve, ms))
85
+ *
86
+ * all.series([
87
+ * greeting => console.log(greeting + ' world'),
88
+ * sleep(1000),
89
+ * greeting => console.log(greeting + ' mom'),
90
+ * sleep(1000),
91
+ * greeting => console.log(greeting + ' goodbye'),
92
+ * ])('hello') // hello world
93
+ * // hello mom
94
+ * // hello goodbye
95
+ * ```
96
+ *
97
+ * @execution series
98
+ */
99
+ function series(...args: any[]): any;
100
+ }
package/always.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export = always;
2
+ import always = require("./_internal/always");
package/and.d.ts ADDED
@@ -0,0 +1,45 @@
1
+ export = and;
2
+ /**
3
+ * @name and
4
+ *
5
+ * @synopsis
6
+ * ```coffeescript [specscript]
7
+ * and(values Array<boolean>) -> result boolean
8
+ *
9
+ * and(...args, predicatesOrValues Array<function|boolean>) -> Promise|boolean
10
+ *
11
+ * and(predicatesOrValues Array<function|boolean>)(...args) -> Promise|boolean
12
+ * ```
13
+ *
14
+ * @description
15
+ * Tests an array of boolean values, returning true if all boolean values are truthy.
16
+ *
17
+ * ```javascript [playground]
18
+ * const oneIsLessThanThree = 1 < 3
19
+ * const twoIsGreaterThanOne = 2 > 1
20
+ * const threeIsEqualToThree = 3 === 3
21
+ *
22
+ * console.log(
23
+ * and([oneIsLessThanThree, twoIsGreaterThanOne, threeIsEqualToThree]),
24
+ * ) // true
25
+ * ```
26
+ *
27
+ * If any values in the array are synchronous or asynchronous predicate functions, `and` takes another argument to test concurrently against the predicate functions, returning true if all array values and resolved values from the predicates are truthy.
28
+ *
29
+ * ```javascript [playground]
30
+ * const isOdd = number => number % 2 == 1
31
+ *
32
+ * const isPositive = number => number > 0
33
+ *
34
+ * const isLessThan3 = number => number < 3
35
+ *
36
+ * console.log(
37
+ * and([isOdd, isPositive, isLessThan3])(1),
38
+ * ) // true
39
+ * ```
40
+ *
41
+ * @execution series
42
+ *
43
+ * @note ...args slows down here by an order of magnitude
44
+ */
45
+ declare function and(...args: any[]): any;
package/assign.d.ts ADDED
@@ -0,0 +1,46 @@
1
+ export = assign;
2
+ /**
3
+ * @name assign
4
+ *
5
+ * @synopsis
6
+ * ```coffeescript [specscript]
7
+ * assign(object Object, resolvers Object<function>) -> result Promise|Object
8
+ *
9
+ * assign(resolvers Object<function>)(object Object) -> result Promise|Object
10
+ * ```
11
+ *
12
+ * @description
13
+ * Function executor and composer. Accepts an object of resolver functions and an argument object. Creates a result object from the argument object, evaluates each resolver with the argument object, and assigns to the result object the evaluations at the corresponding resolver keys.
14
+ *
15
+ * ```javascript [playground]
16
+ * const assignSquaredAndCubed = assign({
17
+ * squared: ({ number }) => number ** 2,
18
+ * cubed: ({ number }) => number ** 3,
19
+ * })
20
+ *
21
+ * console.log(assignSquaredAndCubed({ number: 2 }))
22
+ * // { number: 2, squared: 4, cubed: 8 }
23
+ *
24
+ * console.log(assignSquaredAndCubed({ number: 3 }))
25
+ * // { number: 3, squared: 9, cubed: 27 }
26
+ * ```
27
+ *
28
+ * Any of the resolvers may be asynchronous and return Promises.
29
+ *
30
+ * ```javascript [playground]
31
+ * const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
32
+ *
33
+ * const asyncAssignTotal = assign({
34
+ * async total({ numbers }) {
35
+ * await sleep(500)
36
+ * return numbers.reduce((a, b) => a + b)
37
+ * },
38
+ * })
39
+ *
40
+ * asyncAssignTotal({ numbers: [1, 2, 3, 4, 5] }).then(console.log)
41
+ * // { numbers: [1, 2, 3, 4, 5], total: 15 }
42
+ * ```
43
+ *
44
+ * @execution concurrent
45
+ */
46
+ declare function assign(arg0: any, arg1: any): any;
package/compose.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ export = compose;
2
+ /**
3
+ * @name compose
4
+ *
5
+ * @synopsis
6
+ * ```coffeescript [specscript]
7
+ * compose(funcs Array<function>)(...args) -> result Promise|any
8
+ *
9
+ * compose(...args, funcs Array<function>) -> result Promise|any
10
+ * ```
11
+ *
12
+ * @description
13
+ * Creates a function composition from an array of functions, where each function passes its return value as a single argument to the previous function until all functions have executed. The last function is called with the arguments to the composition, while the result of a function composition is the return value of its first function. If any function of the composition is asynchronous, the result of the execution is a Promise. `compose` is effectively `pipe` in reverse.
14
+ *
15
+ * ```javascript [playground]
16
+ * const f = number => number * 2
17
+ *
18
+ * const g = number => number + 3
19
+ *
20
+ * console.log(
21
+ * compose(5, [f, g]),
22
+ * ) // 16
23
+ * ```
24
+ */
25
+ declare function compose(...args: any[]): any;