rubico 1.9.7 → 2.0.1

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 (593) hide show
  1. package/.eslintignore +5 -0
  2. package/.eslintrc.js +3 -2
  3. package/.github/workflows/nodejs.yml +1 -1
  4. package/AggregateReducer.js +19 -0
  5. package/AggregateReducer.test.js +82 -0
  6. package/CHANGELOG.md +22 -1
  7. package/README.md +158 -81
  8. package/Transducer.js +75 -26
  9. package/Transducer.test.js +117 -0
  10. package/_internal/ComparisonOperator.js +68 -0
  11. package/_internal/File.js +41 -0
  12. package/_internal/FlatMappingAsyncIterator.js +4 -4
  13. package/_internal/FlatMappingIterator.js +1 -1
  14. package/_internal/TimeInLoopSuite.js +138 -0
  15. package/_internal/areAnyValuesPromises.js +23 -0
  16. package/_internal/{arrayAll.js → arrayEvery.js} +4 -4
  17. package/_internal/arrayExtend.js +3 -2
  18. package/_internal/arrayFilter.js +3 -4
  19. package/_internal/{arrayAny.js → arraySome.js} +8 -8
  20. package/_internal/{asyncIteratorAll.js → asyncIteratorEvery.js} +4 -4
  21. package/_internal/{asyncIteratorAny.js → asyncIteratorSome.js} +4 -4
  22. package/_internal/curry4.test.js +25 -0
  23. package/_internal/curry5.test.js +29 -0
  24. package/_internal/curryArgs2.js +43 -0
  25. package/_internal/curryArgs3.test.js +21 -0
  26. package/_internal/curryArgs4.js +65 -0
  27. package/_internal/curryArgs4.test.js +25 -0
  28. package/_internal/equals.js +13 -0
  29. package/_internal/findAllFilePaths.js +22 -0
  30. package/_internal/funcApply.js +2 -0
  31. package/_internal/funcCall.js +14 -0
  32. package/_internal/functionArrayAll.js +26 -0
  33. package/_internal/functionArrayAllSeries.js +55 -0
  34. package/_internal/functionObjectAll.js +32 -0
  35. package/_internal/genericReduce.js +4 -22
  36. package/_internal/genericTransform.js +15 -15
  37. package/_internal/improvedGenericTransform.js +93 -0
  38. package/_internal/{iteratorAll.js → iteratorEvery.js} +4 -4
  39. package/_internal/{iteratorAny.js → iteratorSome.js} +6 -6
  40. package/_internal/leftResolverRightResolverCompare.js +19 -0
  41. package/_internal/leftResolverRightValueCompare.js +16 -0
  42. package/_internal/leftValueRightResolverCompare.js +16 -0
  43. package/_internal/objectReduce.js +0 -1
  44. package/_internal/pathResolve.js +6 -0
  45. package/_internal/{reducerAll.js → reducerEvery.js} +4 -4
  46. package/_internal/reducerFlatMap.js +4 -4
  47. package/_internal/reducerFlatten.js +1 -1
  48. package/_internal/{reducerAny.js → reducerSome.js} +4 -4
  49. package/_internal/timeInLoop.js +37 -0
  50. package/_internal/timeInLoop.test.js +18 -0
  51. package/_internal/timeInLoopAsync.js +35 -0
  52. package/_internal/timeInLoopAsync.test.js +22 -0
  53. package/all.js +106 -40
  54. package/and.js +54 -36
  55. package/archive/{FlatMappingIteratorCool.js → FlatMappingIterator-2020-09-28.js} +1 -1
  56. package/archive/_Promise-2023-05-29.js +93 -0
  57. package/archive/arrayMap2-2023-05-29.js +73 -0
  58. package/archive/benchmarks-v1.9.7/all.js +34 -0
  59. package/archive/benchmarks-v1.9.7/and.js +24 -0
  60. package/archive/benchmarks-v1.9.7/assign.js +174 -0
  61. package/archive/benchmarks-v1.9.7/curry.js +55 -0
  62. package/archive/benchmarks-v1.9.7/eq.js +25 -0
  63. package/archive/benchmarks-v1.9.7/filter.js +1322 -0
  64. package/archive/benchmarks-v1.9.7/flatMap.js +48 -0
  65. package/archive/benchmarks-v1.9.7/get.js +44 -0
  66. package/archive/benchmarks-v1.9.7/gt.js +25 -0
  67. package/archive/benchmarks-v1.9.7/gte.js +25 -0
  68. package/archive/benchmarks-v1.9.7/lt.js +25 -0
  69. package/archive/benchmarks-v1.9.7/lte.js +25 -0
  70. package/archive/benchmarks-v1.9.7/map.js +892 -0
  71. package/archive/benchmarks-v1.9.7/omit.js +28 -0
  72. package/archive/benchmarks-v1.9.7/or.js +51 -0
  73. package/archive/benchmarks-v1.9.7/pick.js +24 -0
  74. package/archive/benchmarks-v1.9.7/pipe.js +152 -0
  75. package/archive/benchmarks-v1.9.7/reduce.js +739 -0
  76. package/archive/benchmarks-v1.9.7/switchCase.js +256 -0
  77. package/archive/benchmarks-v1.9.7/tap.js +90 -0
  78. package/archive/benchmarks-v1.9.7/transform.js +218 -0
  79. package/archive/benchmarks-v1.9.7/tryCatch.js +108 -0
  80. package/assign.js +18 -8
  81. package/bench +65 -0
  82. package/benchmark-output/v1.9.7 +268 -0
  83. package/benchmarks/all.async.js +43 -0
  84. package/benchmarks/all.js +42 -33
  85. package/benchmarks/always.js +15 -0
  86. package/benchmarks/and.async.js +25 -0
  87. package/benchmarks/and.js +20 -19
  88. package/benchmarks/assign.async.js +27 -0
  89. package/benchmarks/assign.js +20 -167
  90. package/benchmarks/curry.js +34 -54
  91. package/benchmarks/eq.async.js +23 -0
  92. package/benchmarks/eq.js +17 -19
  93. package/benchmarks/every.async.js +19 -0
  94. package/benchmarks/every.js +19 -0
  95. package/benchmarks/filter.async.js +32 -0
  96. package/benchmarks/filter.js +27 -1311
  97. package/benchmarks/flatMap.async.js +26 -0
  98. package/benchmarks/flatMap.js +26 -36
  99. package/benchmarks/get.async.js +19 -0
  100. package/benchmarks/get.js +27 -32
  101. package/benchmarks/gt.async.js +23 -0
  102. package/benchmarks/gt.js +17 -19
  103. package/benchmarks/gte.async.js +23 -0
  104. package/benchmarks/gte.js +17 -19
  105. package/benchmarks/lt.async.js +23 -0
  106. package/benchmarks/lt.js +17 -19
  107. package/benchmarks/lte.async.js +23 -0
  108. package/benchmarks/lte.js +17 -19
  109. package/benchmarks/map.async.js +43 -0
  110. package/benchmarks/map.js +24 -876
  111. package/benchmarks/misc/Promise.js +26 -0
  112. package/benchmarks/misc/isPromise.js +30 -0
  113. package/benchmarks/misc/promiseAll.js +36 -0
  114. package/benchmarks/not.js +23 -0
  115. package/benchmarks/omit.js +30 -20
  116. package/benchmarks/or.async.js +25 -0
  117. package/benchmarks/or.js +23 -49
  118. package/benchmarks/pick.js +30 -16
  119. package/benchmarks/pipe.async.js +47 -0
  120. package/benchmarks/pipe.js +46 -151
  121. package/benchmarks/reduce.async.js +32 -0
  122. package/benchmarks/reduce.js +27 -728
  123. package/benchmarks/set.async.js +19 -0
  124. package/benchmarks/set.js +41 -0
  125. package/benchmarks/some.async.js +19 -0
  126. package/benchmarks/some.js +19 -0
  127. package/benchmarks/switchCase.async.js +27 -0
  128. package/benchmarks/switchCase.js +55 -256
  129. package/benchmarks/tap.js +10 -85
  130. package/benchmarks/thunkify.js +15 -0
  131. package/benchmarks/transform.async.js +27 -0
  132. package/benchmarks/transform.js +28 -206
  133. package/benchmarks/tryCatch.async.js +25 -0
  134. package/benchmarks/tryCatch.js +24 -100
  135. package/build +472 -0
  136. package/compose.js +46 -0
  137. package/dist/Transducer.es.js +481 -0
  138. package/dist/Transducer.es.min.js +7 -0
  139. package/dist/Transducer.js +488 -0
  140. package/dist/Transducer.min.js +8 -0
  141. package/dist/Transducer.mjs +481 -0
  142. package/dist/__.es.js +2 -2
  143. package/dist/__.es.min.js +2 -2
  144. package/dist/__.js +2 -2
  145. package/dist/__.min.js +2 -2
  146. package/dist/__.mjs +2 -2
  147. package/dist/all.es.js +173 -92
  148. package/dist/all.es.min.js +3 -3
  149. package/dist/all.js +173 -92
  150. package/dist/all.min.js +3 -3
  151. package/dist/all.mjs +173 -92
  152. package/dist/always.es.js +2 -2
  153. package/dist/always.es.min.js +2 -2
  154. package/dist/always.js +2 -2
  155. package/dist/always.min.js +2 -2
  156. package/dist/always.mjs +2 -2
  157. package/dist/and.es.js +101 -32
  158. package/dist/and.es.min.js +3 -3
  159. package/dist/and.js +101 -32
  160. package/dist/and.min.js +3 -3
  161. package/dist/and.mjs +101 -32
  162. package/dist/assign.es.js +37 -10
  163. package/dist/assign.es.min.js +3 -3
  164. package/dist/assign.js +37 -10
  165. package/dist/assign.min.js +3 -3
  166. package/dist/assign.mjs +37 -10
  167. package/dist/compose.es.js +71 -0
  168. package/dist/compose.es.min.js +7 -0
  169. package/dist/compose.js +78 -0
  170. package/dist/compose.min.js +8 -0
  171. package/dist/compose.mjs +71 -0
  172. package/dist/curry.es.js +2 -2
  173. package/dist/curry.es.min.js +2 -2
  174. package/dist/curry.js +2 -2
  175. package/dist/curry.min.js +2 -2
  176. package/dist/curry.mjs +2 -2
  177. package/dist/eq.es.js +172 -49
  178. package/dist/eq.es.min.js +3 -3
  179. package/dist/eq.js +172 -49
  180. package/dist/eq.min.js +3 -3
  181. package/dist/eq.mjs +172 -49
  182. package/dist/every.es.js +194 -0
  183. package/dist/every.es.min.js +7 -0
  184. package/dist/every.js +201 -0
  185. package/dist/every.min.js +8 -0
  186. package/dist/every.mjs +194 -0
  187. package/dist/filter.es.js +14 -108
  188. package/dist/filter.es.min.js +3 -3
  189. package/dist/filter.js +14 -108
  190. package/dist/filter.min.js +3 -3
  191. package/dist/filter.mjs +14 -108
  192. package/dist/flatMap.es.js +27 -214
  193. package/dist/flatMap.es.min.js +3 -3
  194. package/dist/flatMap.js +27 -214
  195. package/dist/flatMap.min.js +3 -3
  196. package/dist/flatMap.mjs +27 -214
  197. package/dist/{x/forEach.es.js → forEach.es.js} +52 -70
  198. package/dist/forEach.es.min.js +7 -0
  199. package/dist/{x/forEach.js → forEach.js} +52 -70
  200. package/dist/forEach.min.js +8 -0
  201. package/dist/{x/forEach.mjs → forEach.mjs} +52 -70
  202. package/dist/get.es.js +60 -5
  203. package/dist/get.es.min.js +3 -3
  204. package/dist/get.js +60 -5
  205. package/dist/get.min.js +3 -3
  206. package/dist/get.mjs +60 -5
  207. package/dist/gt.es.js +171 -48
  208. package/dist/gt.es.min.js +3 -3
  209. package/dist/gt.js +171 -48
  210. package/dist/gt.min.js +3 -3
  211. package/dist/gt.mjs +171 -48
  212. package/dist/gte.es.js +171 -48
  213. package/dist/gte.es.min.js +3 -3
  214. package/dist/gte.js +171 -48
  215. package/dist/gte.min.js +3 -3
  216. package/dist/gte.mjs +171 -48
  217. package/dist/lt.es.js +171 -48
  218. package/dist/lt.es.min.js +3 -3
  219. package/dist/lt.js +171 -48
  220. package/dist/lt.min.js +3 -3
  221. package/dist/lt.mjs +171 -48
  222. package/dist/lte.es.js +171 -48
  223. package/dist/lte.es.min.js +3 -3
  224. package/dist/lte.js +171 -48
  225. package/dist/lte.min.js +3 -3
  226. package/dist/lte.mjs +171 -48
  227. package/dist/map.es.js +12 -101
  228. package/dist/map.es.min.js +3 -3
  229. package/dist/map.js +12 -101
  230. package/dist/map.min.js +3 -3
  231. package/dist/map.mjs +12 -101
  232. package/dist/not.es.js +75 -14
  233. package/dist/not.es.min.js +3 -3
  234. package/dist/not.js +75 -14
  235. package/dist/not.min.js +3 -3
  236. package/dist/not.mjs +75 -14
  237. package/dist/omit.es.js +7 -2
  238. package/dist/omit.es.min.js +3 -3
  239. package/dist/omit.js +7 -2
  240. package/dist/omit.min.js +3 -3
  241. package/dist/omit.mjs +7 -2
  242. package/dist/or.es.js +99 -31
  243. package/dist/or.es.min.js +3 -3
  244. package/dist/or.js +99 -31
  245. package/dist/or.min.js +3 -3
  246. package/dist/or.mjs +99 -31
  247. package/dist/pick.es.js +8 -3
  248. package/dist/pick.es.min.js +3 -3
  249. package/dist/pick.js +8 -3
  250. package/dist/pick.min.js +3 -3
  251. package/dist/pick.mjs +8 -3
  252. package/dist/pipe.es.js +42 -46
  253. package/dist/pipe.es.min.js +3 -3
  254. package/dist/pipe.js +42 -46
  255. package/dist/pipe.min.js +3 -3
  256. package/dist/pipe.mjs +42 -46
  257. package/dist/reduce.es.js +52 -94
  258. package/dist/reduce.es.min.js +3 -3
  259. package/dist/reduce.js +52 -94
  260. package/dist/reduce.min.js +3 -3
  261. package/dist/reduce.mjs +52 -94
  262. package/dist/rubico.es.js +762 -883
  263. package/dist/rubico.es.min.js +3 -3
  264. package/dist/rubico.global.js +2794 -0
  265. package/dist/rubico.global.min.js +8 -0
  266. package/dist/rubico.js +739 -869
  267. package/dist/rubico.min.js +3 -3
  268. package/dist/rubico.mjs +762 -883
  269. package/dist/set.es.js +18 -3
  270. package/dist/set.es.min.js +3 -3
  271. package/dist/set.js +18 -3
  272. package/dist/set.min.js +3 -3
  273. package/dist/set.mjs +18 -3
  274. package/dist/{any.js → some.es.js} +64 -54
  275. package/dist/some.es.min.js +7 -0
  276. package/dist/{any.mjs → some.js} +72 -48
  277. package/dist/some.min.js +8 -0
  278. package/dist/{any.es.js → some.mjs} +65 -48
  279. package/dist/switchCase.es.js +55 -5
  280. package/dist/switchCase.es.min.js +3 -3
  281. package/dist/switchCase.js +55 -5
  282. package/dist/switchCase.min.js +3 -3
  283. package/dist/switchCase.mjs +55 -5
  284. package/dist/tap.es.js +2 -9
  285. package/dist/tap.es.min.js +3 -3
  286. package/dist/tap.js +2 -9
  287. package/dist/tap.min.js +3 -3
  288. package/dist/tap.mjs +2 -9
  289. package/dist/thunkify.es.js +45 -2
  290. package/dist/thunkify.es.min.js +3 -3
  291. package/dist/thunkify.js +45 -2
  292. package/dist/thunkify.min.js +3 -3
  293. package/dist/thunkify.mjs +45 -2
  294. package/dist/transform.es.js +35 -71
  295. package/dist/transform.es.min.js +3 -3
  296. package/dist/transform.js +35 -71
  297. package/dist/transform.min.js +3 -3
  298. package/dist/transform.mjs +35 -71
  299. package/dist/tryCatch.es.js +33 -17
  300. package/dist/tryCatch.es.min.js +3 -3
  301. package/dist/tryCatch.js +33 -17
  302. package/dist/tryCatch.min.js +3 -3
  303. package/dist/tryCatch.mjs +33 -17
  304. package/dist/x/append.es.js +2 -2
  305. package/dist/x/append.es.min.js +2 -2
  306. package/dist/x/append.js +2 -2
  307. package/dist/x/append.min.js +2 -2
  308. package/dist/x/append.mjs +2 -2
  309. package/dist/x/callProp.es.js +2 -2
  310. package/dist/x/callProp.es.min.js +2 -2
  311. package/dist/x/callProp.js +2 -2
  312. package/dist/x/callProp.min.js +2 -2
  313. package/dist/x/callProp.mjs +2 -2
  314. package/dist/x/defaultsDeep.es.js +2 -2
  315. package/dist/x/defaultsDeep.es.min.js +2 -2
  316. package/dist/x/defaultsDeep.js +2 -2
  317. package/dist/x/defaultsDeep.min.js +2 -2
  318. package/dist/x/defaultsDeep.mjs +2 -2
  319. package/dist/x/differenceWith.es.js +7 -7
  320. package/dist/x/differenceWith.es.min.js +3 -3
  321. package/dist/x/differenceWith.js +7 -7
  322. package/dist/x/differenceWith.min.js +2 -2
  323. package/dist/x/differenceWith.mjs +7 -7
  324. package/dist/x/filterOut.es.js +60 -117
  325. package/dist/x/filterOut.es.min.js +3 -3
  326. package/dist/x/filterOut.js +60 -117
  327. package/dist/x/filterOut.min.js +3 -3
  328. package/dist/x/filterOut.mjs +60 -117
  329. package/dist/x/find.es.js +2 -2
  330. package/dist/x/find.es.min.js +2 -2
  331. package/dist/x/find.js +2 -2
  332. package/dist/x/find.min.js +2 -2
  333. package/dist/x/find.mjs +2 -2
  334. package/dist/x/findIndex.es.js +2 -2
  335. package/dist/x/findIndex.es.min.js +2 -2
  336. package/dist/x/findIndex.js +2 -2
  337. package/dist/x/findIndex.min.js +2 -2
  338. package/dist/x/findIndex.mjs +2 -2
  339. package/dist/x/first.es.js +2 -2
  340. package/dist/x/first.es.min.js +2 -2
  341. package/dist/x/first.js +2 -2
  342. package/dist/x/first.min.js +2 -2
  343. package/dist/x/first.mjs +2 -2
  344. package/dist/x/flatten.es.js +20 -207
  345. package/dist/x/flatten.es.min.js +3 -3
  346. package/dist/x/flatten.js +20 -207
  347. package/dist/x/flatten.min.js +3 -3
  348. package/dist/x/flatten.mjs +20 -207
  349. package/dist/x/groupBy.es.js +52 -94
  350. package/dist/x/groupBy.es.min.js +3 -3
  351. package/dist/x/groupBy.js +52 -94
  352. package/dist/x/groupBy.min.js +3 -3
  353. package/dist/x/groupBy.mjs +52 -94
  354. package/dist/x/has.es.js +2 -2
  355. package/dist/x/has.es.min.js +2 -2
  356. package/dist/x/has.js +2 -2
  357. package/dist/x/has.min.js +2 -2
  358. package/dist/x/has.mjs +2 -2
  359. package/dist/x/identity.es.js +2 -2
  360. package/dist/x/identity.es.min.js +2 -2
  361. package/dist/x/identity.js +2 -2
  362. package/dist/x/identity.min.js +2 -2
  363. package/dist/x/identity.mjs +2 -2
  364. package/dist/x/includes.es.js +2 -2
  365. package/dist/x/includes.es.min.js +2 -2
  366. package/dist/x/includes.js +2 -2
  367. package/dist/x/includes.min.js +2 -2
  368. package/dist/x/includes.mjs +2 -2
  369. package/dist/x/isDeepEqual.es.js +2 -2
  370. package/dist/x/isDeepEqual.es.min.js +2 -2
  371. package/dist/x/isDeepEqual.js +2 -2
  372. package/dist/x/isDeepEqual.min.js +2 -2
  373. package/dist/x/isDeepEqual.mjs +2 -2
  374. package/dist/x/isEmpty.es.js +2 -2
  375. package/dist/x/isEmpty.es.min.js +2 -2
  376. package/dist/x/isEmpty.js +2 -2
  377. package/dist/x/isEmpty.min.js +2 -2
  378. package/dist/x/isEmpty.mjs +2 -2
  379. package/dist/x/isEqual.es.js +2 -2
  380. package/dist/x/isEqual.es.min.js +2 -2
  381. package/dist/x/isEqual.js +2 -2
  382. package/dist/x/isEqual.min.js +2 -2
  383. package/dist/x/isEqual.mjs +2 -2
  384. package/dist/x/isFunction.es.js +2 -2
  385. package/dist/x/isFunction.es.min.js +2 -2
  386. package/dist/x/isFunction.js +2 -2
  387. package/dist/x/isFunction.min.js +2 -2
  388. package/dist/x/isFunction.mjs +2 -2
  389. package/dist/x/isIn.es.js +2 -2
  390. package/dist/x/isIn.es.min.js +2 -2
  391. package/dist/x/isIn.js +2 -2
  392. package/dist/x/isIn.min.js +2 -2
  393. package/dist/x/isIn.mjs +2 -2
  394. package/dist/x/isObject.es.js +2 -2
  395. package/dist/x/isObject.es.min.js +2 -2
  396. package/dist/x/isObject.js +2 -2
  397. package/dist/x/isObject.min.js +2 -2
  398. package/dist/x/isObject.mjs +2 -2
  399. package/dist/x/isString.es.js +2 -2
  400. package/dist/x/isString.es.min.js +2 -2
  401. package/dist/x/isString.js +2 -2
  402. package/dist/x/isString.min.js +2 -2
  403. package/dist/x/isString.mjs +2 -2
  404. package/dist/x/keys.es.js +2 -2
  405. package/dist/x/keys.es.min.js +2 -2
  406. package/dist/x/keys.js +2 -2
  407. package/dist/x/keys.min.js +2 -2
  408. package/dist/x/keys.mjs +2 -2
  409. package/dist/x/last.es.js +2 -2
  410. package/dist/x/last.es.min.js +2 -2
  411. package/dist/x/last.js +2 -2
  412. package/dist/x/last.min.js +2 -2
  413. package/dist/x/last.mjs +2 -2
  414. package/dist/x/maxBy.es.js +59 -6
  415. package/dist/x/maxBy.es.min.js +3 -3
  416. package/dist/x/maxBy.js +59 -6
  417. package/dist/x/maxBy.min.js +3 -3
  418. package/dist/x/maxBy.mjs +59 -6
  419. package/dist/x/noop.es.js +2 -2
  420. package/dist/x/noop.es.min.js +2 -2
  421. package/dist/x/noop.js +2 -2
  422. package/dist/x/noop.min.js +2 -2
  423. package/dist/x/noop.mjs +2 -2
  424. package/dist/x/pluck.es.js +32 -103
  425. package/dist/x/pluck.es.min.js +3 -3
  426. package/dist/x/pluck.js +32 -103
  427. package/dist/x/pluck.min.js +3 -3
  428. package/dist/x/pluck.mjs +32 -103
  429. package/dist/x/prepend.es.js +2 -2
  430. package/dist/x/prepend.es.min.js +2 -2
  431. package/dist/x/prepend.js +2 -2
  432. package/dist/x/prepend.min.js +2 -2
  433. package/dist/x/prepend.mjs +2 -2
  434. package/dist/x/size.es.js +2 -2
  435. package/dist/x/size.es.min.js +2 -2
  436. package/dist/x/size.js +2 -2
  437. package/dist/x/size.min.js +2 -2
  438. package/dist/x/size.mjs +2 -2
  439. package/dist/x/trace.es.js +2 -9
  440. package/dist/x/trace.es.min.js +3 -3
  441. package/dist/x/trace.js +2 -9
  442. package/dist/x/trace.min.js +3 -3
  443. package/dist/x/trace.mjs +2 -9
  444. package/dist/x/unionWith.es.js +2 -2
  445. package/dist/x/unionWith.es.min.js +2 -2
  446. package/dist/x/unionWith.js +2 -2
  447. package/dist/x/unionWith.min.js +2 -2
  448. package/dist/x/unionWith.mjs +2 -2
  449. package/dist/x/uniq.es.js +2 -2
  450. package/dist/x/uniq.es.min.js +2 -2
  451. package/dist/x/uniq.js +2 -2
  452. package/dist/x/uniq.min.js +2 -2
  453. package/dist/x/uniq.mjs +2 -2
  454. package/dist/x/unless.es.js +2 -2
  455. package/dist/x/unless.es.min.js +2 -2
  456. package/dist/x/unless.js +2 -2
  457. package/dist/x/unless.min.js +2 -2
  458. package/dist/x/unless.mjs +2 -2
  459. package/dist/x/values.es.js +2 -2
  460. package/dist/x/values.es.min.js +2 -2
  461. package/dist/x/values.js +2 -2
  462. package/dist/x/values.min.js +2 -2
  463. package/dist/x/values.mjs +2 -2
  464. package/dist/x/when.es.js +2 -2
  465. package/dist/x/when.es.min.js +2 -2
  466. package/dist/x/when.js +2 -2
  467. package/dist/x/when.min.js +2 -2
  468. package/dist/x/when.mjs +2 -2
  469. package/dist-test.js +31 -2042
  470. package/eq.js +21 -63
  471. package/es.js +739 -869
  472. package/every.js +94 -0
  473. package/filter.js +23 -91
  474. package/flatMap.js +75 -70
  475. package/forEach.js +82 -0
  476. package/get.js +23 -6
  477. package/global.js +6 -4
  478. package/gt.js +15 -58
  479. package/gte.js +14 -57
  480. package/index.js +739 -869
  481. package/lt.js +17 -60
  482. package/lte.js +14 -57
  483. package/map.js +9 -94
  484. package/memory-usage/reduce.js +2 -2
  485. package/not.js +27 -45
  486. package/omit.js +4 -0
  487. package/or.js +50 -33
  488. package/package.json +7 -7
  489. package/pick.js +5 -1
  490. package/pipe.js +13 -50
  491. package/reduce.js +42 -51
  492. package/rubico.js +22 -11
  493. package/set.js +43 -10
  494. package/some.js +105 -0
  495. package/switchCase.js +13 -3
  496. package/tap.js +0 -24
  497. package/test.js +847 -1096
  498. package/thunkify.js +9 -0
  499. package/tmp.js +1 -0
  500. package/transform.js +31 -16
  501. package/tryCatch.js +19 -15
  502. package/x/differenceWith.js +3 -3
  503. package/x/filterOut.test.js +6 -6
  504. package/x/flatten.js +1 -1
  505. package/x/flatten.test.js +0 -8
  506. package/x/index.js +0 -2
  507. package/x/pluck.js +18 -27
  508. package/x/pluck.test.js +3 -7
  509. package/x/timeInLoop.js +16 -25
  510. package/x/timeInLoop.test.js +8 -4
  511. package/any.js +0 -82
  512. package/dist/__.min.mjs +0 -7
  513. package/dist/all.min.mjs +0 -7
  514. package/dist/always.min.mjs +0 -7
  515. package/dist/and.min.mjs +0 -7
  516. package/dist/any.es.min.js +0 -7
  517. package/dist/any.min.js +0 -8
  518. package/dist/any.min.mjs +0 -7
  519. package/dist/assign.min.mjs +0 -7
  520. package/dist/curry.min.mjs +0 -7
  521. package/dist/eq.min.mjs +0 -7
  522. package/dist/filter.min.mjs +0 -7
  523. package/dist/flatMap.min.mjs +0 -7
  524. package/dist/fork.es.js +0 -159
  525. package/dist/fork.es.min.js +0 -7
  526. package/dist/fork.js +0 -166
  527. package/dist/fork.min.js +0 -8
  528. package/dist/fork.min.mjs +0 -7
  529. package/dist/fork.mjs +0 -159
  530. package/dist/get.min.mjs +0 -7
  531. package/dist/gt.min.mjs +0 -7
  532. package/dist/gte.min.mjs +0 -7
  533. package/dist/lt.min.mjs +0 -7
  534. package/dist/lte.min.mjs +0 -7
  535. package/dist/map.min.mjs +0 -7
  536. package/dist/not.min.mjs +0 -7
  537. package/dist/omit.min.mjs +0 -7
  538. package/dist/or.min.mjs +0 -7
  539. package/dist/pick.min.mjs +0 -7
  540. package/dist/pipe.min.mjs +0 -7
  541. package/dist/reduce.min.mjs +0 -7
  542. package/dist/rubico.min.mjs +0 -7
  543. package/dist/set.min.mjs +0 -7
  544. package/dist/switchCase.min.mjs +0 -7
  545. package/dist/tap.min.mjs +0 -7
  546. package/dist/thunkify.min.mjs +0 -7
  547. package/dist/transform.min.mjs +0 -7
  548. package/dist/tryCatch.min.mjs +0 -7
  549. package/dist/x/append.min.mjs +0 -7
  550. package/dist/x/callProp.min.mjs +0 -7
  551. package/dist/x/defaultsDeep.min.mjs +0 -7
  552. package/dist/x/differenceWith.min.mjs +0 -7
  553. package/dist/x/filterOut.min.mjs +0 -7
  554. package/dist/x/find.min.mjs +0 -7
  555. package/dist/x/findIndex.min.mjs +0 -7
  556. package/dist/x/first.min.mjs +0 -7
  557. package/dist/x/flatten.min.mjs +0 -7
  558. package/dist/x/forEach.es.min.js +0 -7
  559. package/dist/x/forEach.min.js +0 -8
  560. package/dist/x/forEach.min.mjs +0 -7
  561. package/dist/x/groupBy.min.mjs +0 -7
  562. package/dist/x/has.min.mjs +0 -7
  563. package/dist/x/identity.min.mjs +0 -7
  564. package/dist/x/includes.min.mjs +0 -7
  565. package/dist/x/isDeepEqual.min.mjs +0 -7
  566. package/dist/x/isEmpty.min.mjs +0 -7
  567. package/dist/x/isEqual.min.mjs +0 -7
  568. package/dist/x/isFunction.min.mjs +0 -7
  569. package/dist/x/isIn.min.mjs +0 -7
  570. package/dist/x/isObject.min.mjs +0 -7
  571. package/dist/x/isString.min.mjs +0 -7
  572. package/dist/x/keys.min.mjs +0 -7
  573. package/dist/x/last.min.mjs +0 -7
  574. package/dist/x/maxBy.min.mjs +0 -7
  575. package/dist/x/noop.min.mjs +0 -7
  576. package/dist/x/pluck.min.mjs +0 -7
  577. package/dist/x/prepend.min.mjs +0 -7
  578. package/dist/x/size.min.mjs +0 -7
  579. package/dist/x/trace.min.mjs +0 -7
  580. package/dist/x/unionWith.min.mjs +0 -7
  581. package/dist/x/uniq.min.mjs +0 -7
  582. package/dist/x/unless.min.mjs +0 -7
  583. package/dist/x/values.min.mjs +0 -7
  584. package/dist/x/when.min.mjs +0 -7
  585. package/distributor.js +0 -495
  586. package/fork.js +0 -101
  587. package/x/forEach.js +0 -93
  588. package/x/forEach.test.js +0 -218
  589. /package/{benchmarks → archive/benchmarks-v1.9.7}/any.js +0 -0
  590. /package/{x/forEach.benchmark.js → archive/benchmarks-v1.9.7/forEach.js} +0 -0
  591. /package/{benchmarks → archive/benchmarks-v1.9.7}/fork.js +0 -0
  592. /package/{benchmarks → archive/benchmarks-v1.9.7}/integration.js +0 -0
  593. /package/{benchmarks → archive/benchmarks-v1.9.7}/misc.js +0 -0
package/dist/rubico.mjs CHANGED
@@ -1,14 +1,26 @@
1
1
  /**
2
- * rubico v1.9.7
2
+ * rubico v2.0.1
3
3
  * https://github.com/a-synchronous/rubico
4
- * (c) 2019-2021 Richard Tong
4
+ * (c) 2019-2023 Richard Tong
5
5
  * rubico may be freely distributed under the MIT license.
6
6
  */
7
7
 
8
- const noop = function () {}
9
-
10
8
  const isPromise = value => value != null && typeof value.then == 'function'
11
9
 
10
+ const areAnyValuesPromises = function (values) {
11
+ const length = values.length
12
+ let index = -1
13
+ while (++index < length) {
14
+ const value = values[index]
15
+ if (isPromise(value)) {
16
+ return true
17
+ }
18
+ }
19
+ return false
20
+ }
21
+
22
+ const promiseAll = Promise.all.bind(Promise)
23
+
12
24
  const funcConcat = (
13
25
  funcA, funcB,
14
26
  ) => function pipedFunction(...args) {
@@ -18,82 +30,69 @@ const funcConcat = (
18
30
  : funcB(intermediate)
19
31
  }
20
32
 
21
- const funcConcatSync = (
22
- funcA, funcB,
23
- ) => function pipedFunction(...args) {
24
- return funcB(funcA(...args))
25
- }
26
-
27
- const objectProto = Object.prototype
28
-
29
- const nativeObjectToString = objectProto.toString
33
+ const funcApply = (func, args) => func(...args)
30
34
 
31
- const objectToString = value => nativeObjectToString.call(value)
32
-
33
- const generatorFunctionTag = '[object GeneratorFunction]'
35
+ const __ = Symbol.for('placeholder')
34
36
 
35
- const isGeneratorFunction = value => objectToString(value) == generatorFunctionTag
37
+ // argument resolver for curry2
38
+ const curry2ResolveArg0 = (
39
+ baseFunc, arg1,
40
+ ) => function arg0Resolver(arg0) {
41
+ return baseFunc(arg0, arg1)
42
+ }
36
43
 
37
- const asyncGeneratorFunctionTag = '[object AsyncGeneratorFunction]'
44
+ // argument resolver for curry2
45
+ const curry2ResolveArg1 = (
46
+ baseFunc, arg0,
47
+ ) => function arg1Resolver(arg1) {
48
+ return baseFunc(arg0, arg1)
49
+ }
38
50
 
39
- const isAsyncGeneratorFunction = value => objectToString(value) == asyncGeneratorFunctionTag
51
+ const curry2 = function (baseFunc, arg0, arg1) {
52
+ return arg0 == __
53
+ ? curry2ResolveArg0(baseFunc, arg1)
54
+ : curry2ResolveArg1(baseFunc, arg0)
55
+ }
40
56
 
41
57
  const pipe = function (...args) {
42
58
  const funcs = args.pop()
59
+ const pipeline = funcs.reduce(funcConcat)
43
60
 
44
- if (args.length > 0) {
45
- return funcs.reduce(funcConcat)(...args)
61
+ if (args.length == 0) {
62
+ return pipeline
46
63
  }
47
64
 
48
- let functionPipeline = noop,
49
- functionComposition = noop
50
- return function pipeline(...args) {
51
- const firstArg = args[0]
52
-
53
- if (
54
- typeof firstArg == 'function'
55
- && !isGeneratorFunction(firstArg)
56
- && !isAsyncGeneratorFunction(firstArg)
57
- ) {
58
- if (functionComposition == noop) {
59
- functionComposition = funcs.reduceRight(funcConcat)
60
- }
61
- return functionComposition(firstArg)
62
- }
63
-
64
- if (functionPipeline == noop) {
65
- functionPipeline = funcs.reduce(funcConcat)
66
- }
67
- return functionPipeline(...args)
65
+ if (areAnyValuesPromises(args)) {
66
+ return promiseAll(args).then(curry2(funcApply, pipeline, __))
68
67
  }
69
- }
70
68
 
71
- // funcs Array<function> -> pipeline function
72
- const pipeSync = funcs => funcs.reduce(funcConcatSync)
73
-
74
- pipe.sync = pipeSync
69
+ return pipeline(...args)
70
+ }
75
71
 
76
- const isArray = Array.isArray
72
+ const compose = function (...args) {
73
+ const funcs = args.pop()
74
+ const composition = funcs.reduceRight(funcConcat)
77
75
 
78
- const promiseAll = Promise.all.bind(Promise)
76
+ if (args.length == 0) {
77
+ return composition
78
+ }
79
79
 
80
- const funcAll = funcs => function allFuncs(...args) {
81
- const funcsLength = funcs.length,
82
- result = Array(funcsLength)
83
- let funcsIndex = -1, isAsync = false
84
- while (++funcsIndex < funcsLength) {
85
- const resultItem = funcs[funcsIndex](...args)
86
- if (isPromise(resultItem)) {
87
- isAsync = true
88
- }
89
- result[funcsIndex] = resultItem
80
+ if (areAnyValuesPromises(args)) {
81
+ return promiseAll(args).then(curry2(funcApply, composition, __))
90
82
  }
91
- return isAsync ? promiseAll(result) : result
83
+
84
+ return composition(...args)
92
85
  }
93
86
 
94
87
  const always = value => function getter() { return value }
95
88
 
96
- const __ = Symbol.for('placeholder')
89
+ const thunkifyArgs = (func, args) => function thunk() {
90
+ return func(...args)
91
+ }
92
+
93
+ const thunkConditional = (
94
+ conditionalExpression, thunkOnTruthy, thunkOnFalsy,
95
+ ) => conditionalExpression ? thunkOnTruthy() : thunkOnFalsy()
97
96
 
98
97
  // argument resolver for curry3
99
98
  const curry3ResolveArg0 = (
@@ -126,22 +125,62 @@ const curry3 = function (baseFunc, arg0, arg1, arg2) {
126
125
  return curry3ResolveArg2(baseFunc, arg0, arg1)
127
126
  }
128
127
 
129
- const objectSet = function (object, property, value) {
130
- object[property] = value
131
- return object
128
+ const tap = func => function tapping(...args) {
129
+ const result = args[0],
130
+ call = func(...args)
131
+ return isPromise(call) ? call.then(always(result)) : result
132
132
  }
133
133
 
134
- const funcObjectAll = funcs => function objectAllFuncs(...args) {
135
- const result = {}, promises = []
136
- for (const key in funcs) {
137
- const resultItem = funcs[key](...args)
134
+ tap.if = (predicate, func) => function tappingIf(...args) {
135
+ const predication = predicate(...args)
136
+ if (isPromise(predication)) {
137
+ return predication.then(curry3(
138
+ thunkConditional, __, thunkifyArgs(tap(func), args), always(args[0])))
139
+ }
140
+ if (predication) {
141
+ const execution = func(...args)
142
+ if (isPromise(execution)) {
143
+ return execution.then(always(args[0]))
144
+ }
145
+ }
146
+ return args[0]
147
+ }
148
+
149
+ const isArray = Array.isArray
150
+
151
+ // argument resolver for curryArgs2
152
+ const curryArgs2ResolveArgs0 = (
153
+ baseFunc, arg1, arg2,
154
+ ) => function args0Resolver(...args) {
155
+ return baseFunc(args, arg1)
156
+ }
157
+
158
+ // argument resolver for curryArgs2
159
+ const curryArgs2ResolveArgs1 = (
160
+ baseFunc, arg0, arg2,
161
+ ) => function arg1Resolver(...args) {
162
+ return baseFunc(arg0, args)
163
+ }
164
+
165
+ const curryArgs2 = function (baseFunc, arg0, arg1) {
166
+ if (arg0 == __) {
167
+ return curryArgs2ResolveArgs0(baseFunc, arg1)
168
+ }
169
+ return curryArgs2ResolveArgs1(baseFunc, arg0)
170
+ }
171
+
172
+ const functionArrayAll = function (funcs, args) {
173
+ const funcsLength = funcs.length,
174
+ result = Array(funcsLength)
175
+ let funcsIndex = -1, isAsync = false
176
+ while (++funcsIndex < funcsLength) {
177
+ const resultItem = funcs[funcsIndex](...args)
138
178
  if (isPromise(resultItem)) {
139
- promises.push(resultItem.then(curry3(objectSet, result, key, __)))
140
- } else {
141
- result[key] = resultItem
179
+ isAsync = true
142
180
  }
181
+ result[funcsIndex] = resultItem
143
182
  }
144
- return promises.length == 0 ? result : promiseAll(promises).then(always(result))
183
+ return isAsync ? promiseAll(result) : result
145
184
  }
146
185
 
147
186
  // argument resolver for curry4
@@ -185,7 +224,12 @@ const curry4 = function (baseFunc, arg0, arg1, arg2, arg3) {
185
224
  return curry4ResolveArg3(baseFunc, arg0, arg1, arg2)
186
225
  }
187
226
 
188
- const asyncFuncAllSeries = async function (funcs, args, result, funcsIndex) {
227
+ const objectSet = function (object, property, value) {
228
+ object[property] = value
229
+ return object
230
+ }
231
+
232
+ const asyncFunctionArrayAllSeries = async function (funcs, args, result, funcsIndex) {
189
233
  const funcsLength = funcs.length
190
234
  while (++funcsIndex < funcsLength) {
191
235
  const resultItem = funcs[funcsIndex](...args)
@@ -194,7 +238,7 @@ const asyncFuncAllSeries = async function (funcs, args, result, funcsIndex) {
194
238
  return result
195
239
  }
196
240
 
197
- const funcAllSeries = funcs => function allFuncsSeries(...args) {
241
+ const functionArrayAllSeries = function (funcs, args) {
198
242
  const funcsLength = funcs.length, result = []
199
243
  let funcsIndex = -1
200
244
  while (++funcsIndex < funcsLength) {
@@ -202,94 +246,106 @@ const funcAllSeries = funcs => function allFuncsSeries(...args) {
202
246
  if (isPromise(resultItem)) {
203
247
  return resultItem.then(funcConcat(
204
248
  curry3(objectSet, result, funcsIndex, __),
205
- curry4(asyncFuncAllSeries, funcs, args, __, funcsIndex)))
249
+ curry4(asyncFunctionArrayAllSeries, funcs, args, __, funcsIndex)))
206
250
  }
207
251
  result[funcsIndex] = resultItem
208
252
  }
209
253
  return result
210
254
  }
211
255
 
212
- const fork = funcs => isArray(funcs) ? funcAll(funcs) : funcObjectAll(funcs)
213
-
214
- fork.series = funcs => isArray(funcs) ? funcAllSeries(funcs) : funcObjectAll(funcs)
256
+ const functionObjectAll = function (funcs, args) {
257
+ const result = {}, promises = []
258
+ for (const key in funcs) {
259
+ const resultItem = funcs[key](...args)
260
+ if (isPromise(resultItem)) {
261
+ promises.push(resultItem.then(curry3(objectSet, result, key, __)))
262
+ } else {
263
+ result[key] = resultItem
264
+ }
265
+ }
266
+ return promises.length == 0 ? result : promiseAll(promises).then(always(result))
267
+ }
215
268
 
216
- const objectAssign = Object.assign
269
+ const all = function (...args) {
270
+ const funcs = args.pop()
271
+ if (args.length == 0) {
272
+ return isArray(funcs)
273
+ ? curryArgs2(functionArrayAll, funcs, __)
274
+ : curryArgs2(functionObjectAll, funcs, __)
275
+ }
217
276
 
218
- const assign = function (funcs) {
219
- const allFuncs = funcObjectAll(funcs)
220
- return function assignment(value) {
221
- const result = allFuncs(value)
222
- return isPromise(result)
223
- ? result.then(curry3(objectAssign, {}, value, __))
224
- : ({ ...value, ...result })
277
+ if (areAnyValuesPromises(args)) {
278
+ return isArray(funcs)
279
+ ? promiseAll(args).then(curry2(functionArrayAll, funcs, __))
280
+ : promiseAll(args).then(curry2(functionObjectAll, funcs, __))
225
281
  }
226
- }
227
282
 
228
- const tapSync = func => function tapping(...args) {
229
- func(...args)
230
- return args[0]
283
+ return isArray(funcs)
284
+ ? functionArrayAll(funcs, args)
285
+ : functionObjectAll(funcs, args)
231
286
  }
232
287
 
233
- const thunkifyArgs = (func, args) => function thunk() {
234
- return func(...args)
288
+ all.series = function allSeries(...args) {
289
+ const funcs = args.pop()
290
+ if (args.length == 0) {
291
+ return curryArgs2(functionArrayAllSeries, funcs, __)
292
+ }
293
+ if (areAnyValuesPromises(args)) {
294
+ return promiseAll(args).then(curry2(functionArrayAllSeries, funcs, __))
295
+ }
296
+ return functionArrayAllSeries(funcs, args)
235
297
  }
236
298
 
237
- const thunkConditional = (
238
- conditionalExpression, thunkOnTruthy, thunkOnFalsy,
239
- ) => conditionalExpression ? thunkOnTruthy() : thunkOnFalsy()
299
+ const objectAssign = Object.assign
240
300
 
241
- const tap = func => function tapping(...args) {
242
- const result = args[0],
243
- call = func(...args)
244
- return isPromise(call) ? call.then(always(result)) : result
301
+ // _assign(object Object, funcs Object<function>) -> Promise|Object
302
+ const _assign = function (object, funcs) {
303
+ const result = functionObjectAll(funcs, [object])
304
+ return isPromise(result)
305
+ ? result.then(curry3(objectAssign, {}, object, __))
306
+ : ({ ...object, ...result })
245
307
  }
246
308
 
247
- tap.sync = tapSync
248
-
249
- tap.if = (predicate, func) => function tappingIf(...args) {
250
- const predication = predicate(...args)
251
- if (isPromise(predication)) {
252
- return predication.then(curry3(
253
- thunkConditional, __, thunkifyArgs(tap(func), args), always(args[0])))
254
- }
255
- if (predication) {
256
- const execution = func(...args)
257
- if (isPromise(execution)) {
258
- return execution.then(always(args[0]))
259
- }
309
+ const assign = function (arg0, arg1) {
310
+ if (arg1 == null) {
311
+ return curry2(_assign, __, arg0)
260
312
  }
261
- return args[0]
313
+ return isPromise(arg0)
314
+ ? arg0.then(curry2(_assign, __, arg1))
315
+ : _assign(arg0, arg1)
262
316
  }
263
317
 
264
318
  const catcherApply = function (catcher, err, args) {
265
319
  return catcher(err, ...args)
266
320
  }
267
321
 
322
+ // _tryCatch(tryer function, catcher function, args Array) -> Promise
323
+ const _tryCatch = function (tryer, catcher, args) {
324
+ try {
325
+ const result = tryer(...args)
326
+ return isPromise(result)
327
+ ? result.catch(curry3(catcherApply, catcher, __, args))
328
+ : result
329
+ } catch (error) {
330
+ return catcher(error, ...args)
331
+ }
332
+ }
333
+
268
334
  const tryCatch = function (...args) {
269
335
  if (args.length > 2) {
270
336
  const catcher = args.pop(),
271
337
  tryer = args.pop()
272
- try {
273
- const result = tryer(...args)
274
- return isPromise(result)
275
- ? result.catch(curry3(catcherApply, catcher, __, args))
276
- : result
277
- } catch (error) {
278
- return catcher(error, ...args)
338
+ if (areAnyValuesPromises(args)) {
339
+ return promiseAll(args)
340
+ .then(curry3(_tryCatch, tryer, catcher, __))
279
341
  }
342
+ return _tryCatch(tryer, catcher, args)
280
343
  }
281
344
 
282
345
  const tryer = args[0],
283
346
  catcher = args[1]
284
347
  return function tryCatcher(...args) {
285
- try {
286
- const result = tryer(...args)
287
- return isPromise(result)
288
- ? result.catch(curry3(catcherApply, catcher, __, args))
289
- : result
290
- } catch (error) {
291
- return catcher(error, ...args)
292
- }
348
+ return _tryCatch(tryer, catcher, args)
293
349
  }
294
350
  }
295
351
 
@@ -377,13 +433,49 @@ const nonfunctionsConditional = function (array, index) {
377
433
  return array[index]
378
434
  }
379
435
 
380
- const switchCase = values => {
436
+ // argument resolver for curryArgs3
437
+ const curryArgs3ResolveArgs0 = (
438
+ baseFunc, arg1, arg2,
439
+ ) => function args0Resolver(...args) {
440
+ return baseFunc(args, arg1, arg2)
441
+ }
442
+
443
+ // argument resolver for curryArgs3
444
+ const curryArgs3ResolveArgs1 = (
445
+ baseFunc, arg0, arg2,
446
+ ) => function arg1Resolver(...args) {
447
+ return baseFunc(arg0, args, arg2)
448
+ }
449
+
450
+ // argument resolver for curryArgs3
451
+ const curryArgs3ResolveArgs2 = (
452
+ baseFunc, arg0, arg1,
453
+ ) => function arg2Resolver(...args) {
454
+ return baseFunc(arg0, arg1, args)
455
+ }
456
+
457
+ const curryArgs3 = function (baseFunc, arg0, arg1, arg2) {
458
+ if (arg0 == __) {
459
+ return curryArgs3ResolveArgs0(baseFunc, arg1, arg2)
460
+ }
461
+ if (arg1 == __) {
462
+ return curryArgs3ResolveArgs1(baseFunc, arg0, arg2)
463
+ }
464
+ return curryArgs3ResolveArgs2(baseFunc, arg0, arg1)
465
+ }
466
+
467
+ const switchCase = (...args) => {
468
+ const values = args.pop()
381
469
  if (areAllValuesNonfunctions(values)) {
382
470
  return nonfunctionsConditional(values, -2)
383
471
  }
384
- return function switchingCases(...args) {
385
- return arrayConditional(values, args, -2)
472
+ if (args.length == 0) {
473
+ return curryArgs3(arrayConditional, values, __, -2)
386
474
  }
475
+ if (areAnyValuesPromises(args)) {
476
+ return promiseAll(args).then(curry3(arrayConditional, values, __, -2))
477
+ }
478
+ return arrayConditional(values, args, -2)
387
479
  }
388
480
 
389
481
  const symbolIterator = Symbol.iterator
@@ -422,26 +514,6 @@ const MappingAsyncIterator = (asyncIterator, mapper) => ({
422
514
  }
423
515
  })
424
516
 
425
- // argument resolver for curry2
426
- const curry2ResolveArg0 = (
427
- baseFunc, arg1,
428
- ) => function arg0Resolver(arg0) {
429
- return baseFunc(arg0, arg1)
430
- }
431
-
432
- // argument resolver for curry2
433
- const curry2ResolveArg1 = (
434
- baseFunc, arg0,
435
- ) => function arg1Resolver(arg1) {
436
- return baseFunc(arg0, arg1)
437
- }
438
-
439
- const curry2 = function (baseFunc, arg0, arg1) {
440
- return arg0 == __
441
- ? curry2ResolveArg0(baseFunc, arg1)
442
- : curry2ResolveArg1(baseFunc, arg0)
443
- }
444
-
445
517
  const isObject = value => {
446
518
  if (value == null) {
447
519
  return false
@@ -467,31 +539,6 @@ const arrayMap = function (array, mapper) {
467
539
  return isAsync ? promiseAll(result) : result
468
540
  }
469
541
 
470
- const generatorFunctionMap = (
471
- generatorFunc, mapper,
472
- ) => function* mappingGeneratorFunc(...args) {
473
- for (const item of generatorFunc(...args)) {
474
- yield mapper(item)
475
- }
476
- }
477
-
478
- const asyncGeneratorFunctionMap = function (asyncGeneratorFunc, mapper) {
479
- return async function* mappingAsyncGeneratorFunc(...args) {
480
- for await (const item of asyncGeneratorFunc(...args)) {
481
- yield mapper(item)
482
- }
483
- }
484
- }
485
-
486
- const reducerMap = (
487
- reducer, mapper,
488
- ) => function mappingReducer(result, reducerItem) {
489
- const mappingReducerItem = mapper(reducerItem)
490
- return isPromise(mappingReducerItem)
491
- ? mappingReducerItem.then(curry2(reducer, result, __))
492
- : reducer(result, mappingReducerItem)
493
- }
494
-
495
542
  const callPropUnary = (value, property, arg0) => value[property](arg0)
496
543
 
497
544
  const stringMap = function (string, mapper) {
@@ -602,6 +649,11 @@ const arrayMapSeries = function (array, mapper) {
602
649
  return result
603
650
  }
604
651
 
652
+ const tapSync = func => function tapping(...args) {
653
+ func(...args)
654
+ return args[0]
655
+ }
656
+
605
657
  const promiseRace = Promise.race.bind(Promise)
606
658
 
607
659
  const arrayMapPoolAsync = async function (
@@ -647,38 +699,6 @@ const arrayMapPool = function (array, mapper, concurrentLimit) {
647
699
  return result
648
700
  }
649
701
 
650
- const arrayMapWithIndex = function (array, mapper) {
651
- const arrayLength = array.length,
652
- result = Array(arrayLength)
653
- let index = -1, isAsync = false
654
- while (++index < arrayLength) {
655
- const resultItem = mapper(array[index], index, array)
656
- if (isPromise(resultItem)) {
657
- isAsync = true
658
- }
659
- result[index] = resultItem
660
- }
661
- return isAsync ? promiseAll(result) : result
662
- }
663
-
664
- const hasOwnProperty = Object.prototype.hasOwnProperty
665
- const hasOwn = (obj, key) => hasOwnProperty.call(obj, key)
666
-
667
- const objectMapOwn = function (object, mapper) {
668
- const result = {}
669
- let isAsync = false
670
- for (const key in object) {
671
- if (hasOwn(object, key)) {
672
- const resultItem = mapper(object[key])
673
- if (isPromise(resultItem)) {
674
- isAsync = true
675
- }
676
- result[key] = resultItem
677
- }
678
- }
679
- return isAsync ? promiseObjectAll(result) : result
680
- }
681
-
682
702
  const _curryArity = (arity, func, args) => function curried(...curriedArgs) {
683
703
  const argsLength = args.length,
684
704
  curriedArgsLength = curriedArgs.length,
@@ -786,15 +806,6 @@ const _map = function (value, mapper) {
786
806
  if (isArray(value)) {
787
807
  return arrayMap(value, mapper)
788
808
  }
789
- if (typeof value == 'function') {
790
- if (isGeneratorFunction(value)) {
791
- return generatorFunctionMap(value, mapper)
792
- }
793
- if (isAsyncGeneratorFunction(value)) {
794
- return asyncGeneratorFunctionMap(value, mapper)
795
- }
796
- return reducerMap(value, mapper)
797
- }
798
809
  if (value == null) {
799
810
  return value
800
811
  }
@@ -828,10 +839,15 @@ const _map = function (value, mapper) {
828
839
 
829
840
  const map = (...args) => {
830
841
  const mapper = args.pop()
831
- if (args.length > 0) {
832
- return _map(args[0], mapper)
842
+ if (args.length == 0) {
843
+ return curry2(_map, __, mapper)
833
844
  }
834
- return curry2(_map, __, mapper)
845
+
846
+ const collection = args[0]
847
+ if (isPromise(collection)) {
848
+ return collection.then(curry2(_map, __, mapper))
849
+ }
850
+ return _map(collection, mapper)
835
851
  }
836
852
 
837
853
  map.entries = function mapEntries(mapper) {
@@ -863,20 +879,6 @@ map.pool = (concurrencyLimit, mapper) => function concurrentPoolMapping(value) {
863
879
  throw new TypeError(`${value} is not an Array`)
864
880
  }
865
881
 
866
- map.withIndex = mapper => function mappingWithIndex(value) {
867
- if (isArray(value)) {
868
- return arrayMapWithIndex(value, mapper)
869
- }
870
- throw new TypeError(`${value} is not an Array`)
871
- }
872
-
873
- map.own = mapper => function mappingOwnProperties(value) {
874
- if (isObject(value) && !isArray(value)) {
875
- return objectMapOwn(value, mapper)
876
- }
877
- throw new TypeError(`${value} is not an Object`)
878
- }
879
-
880
882
  const FilteringIterator = (iterator, predicate) => ({
881
883
  [symbolIterator]() {
882
884
  return this
@@ -946,12 +948,11 @@ const arrayFilter = function (array, predicate) {
946
948
  resultIndex = -1
947
949
  while (++index < arrayLength) {
948
950
  const item = array[index],
949
- shouldIncludeItem = predicate(item)
951
+ shouldIncludeItem = predicate(item, index, array)
950
952
  if (isPromise(shouldIncludeItem)) {
951
953
  return promiseAll(
952
- arrayExtendMap(
953
- [shouldIncludeItem], array, predicate, index)).then(
954
- curry4(arrayFilterByConditions, array, result, index - 1, __))
954
+ arrayExtendMap([shouldIncludeItem], array, predicate, index)
955
+ ).then(curry4(arrayFilterByConditions, array, result, index - 1, __))
955
956
  }
956
957
  if (shouldIncludeItem) {
957
958
  result[++resultIndex] = item
@@ -960,31 +961,6 @@ const arrayFilter = function (array, predicate) {
960
961
  return result
961
962
  }
962
963
 
963
- const generatorFunctionFilter = (
964
- generatorFunction, predicate,
965
- ) => function* filteringGeneratorFunction(...args) {
966
- yield* FilteringIterator(generatorFunction(...args), predicate)
967
- }
968
-
969
- const asyncGeneratorFunctionFilter = (
970
- asyncGeneratorFunction, predicate,
971
- ) => async function* filteringAsyncGeneratorFunction(...args) {
972
- yield* FilteringAsyncIterator(asyncGeneratorFunction(...args), predicate)
973
- }
974
-
975
- const reducerFilter = (
976
- reducer, predicate,
977
- ) => function filteringReducer(result, item) {
978
- const shouldInclude = predicate(item)
979
- return isPromise(shouldInclude)
980
- ? shouldInclude.then(curry3(
981
- thunkConditional,
982
- __,
983
- thunkify2(reducer, result, item),
984
- always(result)))
985
- : shouldInclude ? reducer(result, item) : result
986
- }
987
-
988
964
  const stringFilter = function (string, predicate) {
989
965
  const filteredCharactersArray = arrayFilter(string, predicate)
990
966
  return isPromise(filteredCharactersArray)
@@ -996,6 +972,8 @@ const thunkify1 = (func, arg0) => function thunk() {
996
972
  return func(arg0)
997
973
  }
998
974
 
975
+ const noop = function () {}
976
+
999
977
  const setFilter = function (value, predicate) {
1000
978
  const result = new Set(),
1001
979
  resultAdd = result.add.bind(result),
@@ -1062,53 +1040,10 @@ const objectFilter = function (object, predicate) {
1062
1040
  : promiseAll(promises).then(always(result))
1063
1041
  }
1064
1042
 
1065
- const arrayExtendMapWithIndex = function (
1066
- array, values, valuesMapper, valuesIndex,
1067
- ) {
1068
- const valuesLength = values.length
1069
- let arrayIndex = array.length - 1
1070
-
1071
- while (++valuesIndex < valuesLength) {
1072
- array[++arrayIndex] = valuesMapper(
1073
- values[valuesIndex], valuesIndex, values)
1074
- }
1075
- return array
1076
- }
1077
-
1078
- const arrayFilterWithIndex = function (array, predicate) {
1079
- const arrayLength = array.length,
1080
- result = []
1081
- let index = -1,
1082
- resultIndex = -1
1083
- while (++index < arrayLength) {
1084
- const item = array[index],
1085
- shouldIncludeItem = predicate(item, index, array)
1086
- if (isPromise(shouldIncludeItem)) {
1087
- return promiseAll(
1088
- arrayExtendMapWithIndex(
1089
- [shouldIncludeItem], array, predicate, index)).then(
1090
- curry4(arrayFilterByConditions, array, result, index - 1, __))
1091
- }
1092
- if (shouldIncludeItem) {
1093
- result[++resultIndex] = item
1094
- }
1095
- }
1096
- return result
1097
- }
1098
-
1099
1043
  const _filter = function (value, predicate) {
1100
1044
  if (isArray(value)) {
1101
1045
  return arrayFilter(value, predicate)
1102
1046
  }
1103
- if (typeof value == 'function') {
1104
- if (isGeneratorFunction(value)) {
1105
- return generatorFunctionFilter(value, predicate)
1106
- }
1107
- if (isAsyncGeneratorFunction(value)) {
1108
- return asyncGeneratorFunctionFilter(value, predicate)
1109
- }
1110
- return reducerFilter(value, predicate)
1111
- }
1112
1047
  if (value == null) {
1113
1048
  return value
1114
1049
  }
@@ -1139,51 +1074,27 @@ const _filter = function (value, predicate) {
1139
1074
 
1140
1075
  const filter = function (...args) {
1141
1076
  const predicate = args.pop()
1142
- if (args.length > 0) {
1143
- return _filter(args[0], predicate)
1077
+ if (args.length == 0) {
1078
+ return curry2(_filter, __, predicate)
1144
1079
  }
1145
- return curry2(_filter, __, predicate)
1080
+ return _filter(args[0], predicate)
1146
1081
  }
1147
1082
 
1148
- filter.withIndex = predicate => function filteringWithIndex(value) {
1149
- if (isArray(value)) {
1150
- return arrayFilterWithIndex(value, predicate)
1151
- }
1152
- throw new TypeError(`${value} is not an Array`)
1153
- }
1083
+ const objectValues = Object.values
1154
1084
 
1155
- // argument resolver for curryArgs3
1156
- const curryArgs3ResolveArgs0 = (
1157
- baseFunc, arg1, arg2,
1158
- ) => function args0Resolver(...args) {
1159
- return baseFunc(args, arg1, arg2)
1160
- }
1085
+ const objectProto = Object.prototype
1161
1086
 
1162
- // argument resolver for curryArgs3
1163
- const curryArgs3ResolveArgs1 = (
1164
- baseFunc, arg0, arg2,
1165
- ) => function arg1Resolver(...args) {
1166
- return baseFunc(arg0, args, arg2)
1167
- }
1087
+ const nativeObjectToString = objectProto.toString
1168
1088
 
1169
- // argument resolver for curryArgs3
1170
- const curryArgs3ResolveArgs2 = (
1171
- baseFunc, arg0, arg1,
1172
- ) => function arg2Resolver(...args) {
1173
- return baseFunc(arg0, arg1, args)
1174
- }
1089
+ const objectToString = value => nativeObjectToString.call(value)
1175
1090
 
1176
- const curryArgs3 = function (baseFunc, arg0, arg1, arg2) {
1177
- if (arg0 == __) {
1178
- return curryArgs3ResolveArgs0(baseFunc, arg1, arg2)
1179
- }
1180
- if (arg1 == __) {
1181
- return curryArgs3ResolveArgs1(baseFunc, arg0, arg2)
1182
- }
1183
- return curryArgs3ResolveArgs2(baseFunc, arg0, arg1)
1184
- }
1091
+ const generatorFunctionTag = '[object GeneratorFunction]'
1185
1092
 
1186
- const objectValues = Object.values
1093
+ const isGeneratorFunction = value => objectToString(value) == generatorFunctionTag
1094
+
1095
+ const asyncGeneratorFunctionTag = '[object AsyncGeneratorFunction]'
1096
+
1097
+ const isAsyncGeneratorFunction = value => objectToString(value) == asyncGeneratorFunctionTag
1187
1098
 
1188
1099
  const iteratorReduceAsync = async function (
1189
1100
  iterator, reducer, result,
@@ -1320,13 +1231,6 @@ const curry5 = function (baseFunc, arg0, arg1, arg2, arg3, arg4) {
1320
1231
 
1321
1232
  const objectKeys = Object.keys
1322
1233
 
1323
- const objectGetFirstKey = function (object) {
1324
- for (const key in object) {
1325
- return key
1326
- }
1327
- return undefined
1328
- }
1329
-
1330
1234
  const objectReduceAsync = async function (object, reducer, result, keys, index) {
1331
1235
  const keysLength = keys.length
1332
1236
  while (++index < keysLength) {
@@ -1387,18 +1291,6 @@ const mapReduce = function (map, reducer, result) {
1387
1291
  return result
1388
1292
  }
1389
1293
 
1390
- const generatorFunctionReduce = (
1391
- generatorFunction, reducer, result,
1392
- ) => funcConcatSync(
1393
- generatorFunction,
1394
- curry3(iteratorReduce, __, reducer, result))
1395
-
1396
- const asyncGeneratorFunctionReduce = (
1397
- asyncGeneratorFunction, reducer, result,
1398
- ) => funcConcatSync(
1399
- asyncGeneratorFunction,
1400
- curry3(asyncIteratorReduce, __, reducer, result))
1401
-
1402
1294
  const reducerConcat = (
1403
1295
  reducerA, reducerB,
1404
1296
  ) => function pipedReducer(result, item) {
@@ -1408,26 +1300,10 @@ const reducerConcat = (
1408
1300
  : reducerB(intermediate, item)
1409
1301
  }
1410
1302
 
1411
- const genericReduce = function (args, reducer, result) {
1412
- const collection = args[0]
1303
+ const genericReduce = function (collection, reducer, result) {
1413
1304
  if (isArray(collection)) {
1414
1305
  return arrayReduce(collection, reducer, result)
1415
1306
  }
1416
- if (typeof collection == 'function') {
1417
- if (isGeneratorFunction(collection)) {
1418
- return generatorFunctionReduce(collection, reducer, result)
1419
- }
1420
- if (isAsyncGeneratorFunction(collection)) {
1421
- return asyncGeneratorFunctionReduce(collection, reducer, result)
1422
- }
1423
- return curryArgs3(
1424
- genericReduce,
1425
- __,
1426
- args.length == 1
1427
- ? reducerConcat(reducer, collection)
1428
- : args.reduce(reducerConcat, reducer),
1429
- result)
1430
- }
1431
1307
  if (collection == null) {
1432
1308
  return result === undefined
1433
1309
  ? curry2(reducer, collection, __)
@@ -1462,38 +1338,33 @@ const genericReduce = function (args, reducer, result) {
1462
1338
  : reducer(result, collection)
1463
1339
  }
1464
1340
 
1465
- const reduce = function (...args) {
1466
- if (typeof args[0] != 'function') {
1467
- const reducer = args[1]
1468
- const initialValue = args[2]
1469
- if (typeof initialValue == 'function') {
1470
- return genericReduce([args[0]], reducer, initialValue(args[0]))
1471
- }
1472
- return genericReduce([args[0]], reducer, initialValue)
1341
+ // _reduce(collection any, reducer function, initialValue function|any) -> Promise
1342
+ const _reduce = function (collection, reducer, initialValue) {
1343
+ if (typeof initialValue == 'function') {
1344
+ const actualInitialValue = initialValue(collection)
1345
+ return isPromise(actualInitialValue)
1346
+ ? actualInitialValue.then(curry3(genericReduce, collection, reducer, __))
1347
+ : genericReduce(collection, reducer, actualInitialValue)
1473
1348
  }
1349
+ return isPromise(initialValue)
1350
+ ? initialValue.then(curry3(genericReduce, collection, reducer, __))
1351
+ : genericReduce(collection, reducer, initialValue)
1352
+ }
1474
1353
 
1475
- const reducer = args[0]
1476
- const initialValue = args[1]
1477
-
1478
- if (typeof initialValue == 'function') {
1479
- return function reducing(...args) {
1480
- const result = initialValue(...args)
1481
- return isPromise(result)
1482
- ? result.then(curry3(genericReduce, args, reducer, __))
1483
- : genericReduce(args, reducer, result)
1484
- }
1354
+ const reduce = function (...args) {
1355
+ if (typeof args[0] == 'function') {
1356
+ return curry3(_reduce, __, args[0], args[1])
1357
+ }
1358
+ if (isPromise(args[0])) {
1359
+ return args[0].then(curry3(_reduce, __, args[1], args[2]))
1485
1360
  }
1486
- return curryArgs3(genericReduce, __, reducer, initialValue)
1361
+ return _reduce(args[0], args[1], args[2])
1487
1362
  }
1488
1363
 
1489
1364
  const isBinary = ArrayBuffer.isView
1490
1365
 
1491
1366
  const add = (a, b) => a + b
1492
1367
 
1493
- const isArrayLike = function (value) {
1494
- return value != null && value.length > 0
1495
- }
1496
-
1497
1368
  const _arrayExtend = function (array, values) {
1498
1369
  const arrayLength = array.length,
1499
1370
  valuesLength = values.length
@@ -1505,7 +1376,7 @@ const _arrayExtend = function (array, values) {
1505
1376
  }
1506
1377
 
1507
1378
  const arrayExtend = function (array, values) {
1508
- if (isArrayLike(values)) {
1379
+ if (isArray(values) || isBinary(values)) {
1509
1380
  return _arrayExtend(array, values)
1510
1381
  }
1511
1382
  array.push(values)
@@ -1576,57 +1447,66 @@ const callConcat = function (object, values) {
1576
1447
  return object.concat(values)
1577
1448
  }
1578
1449
 
1579
- const identityTransform = function (args, transducer, result) {
1580
- const nil = genericReduce(args, transducer(noop), null)
1450
+ const identityTransform = function (collection, transducer, result) {
1451
+ const nil = genericReduce(collection, transducer(noop), null)
1581
1452
  return isPromise(nil) ? nil.then(always(result)) : result
1582
1453
  }
1583
1454
 
1584
- const genericTransform = function (args, transducer, result) {
1455
+ const genericTransform = function (collection, transducer, result) {
1585
1456
  if (isArray(result)) {
1586
- return genericReduce(args, transducer(arrayExtend), result)
1457
+ return genericReduce(collection, transducer(arrayExtend), result)
1587
1458
  }
1588
1459
  if (isBinary(result)) {
1589
- const intermediateArray = genericReduce(args, transducer(arrayExtend), [])
1460
+ const intermediateArray = genericReduce(collection, transducer(arrayExtend), [])
1590
1461
  return isPromise(intermediateArray)
1591
1462
  ? intermediateArray.then(curry2(binaryExtend, result, __))
1592
1463
  : binaryExtend(result, intermediateArray)
1593
1464
  }
1594
1465
  if (result == null) {
1595
- return identityTransform(args, transducer, result)
1466
+ return identityTransform(collection, transducer, result)
1596
1467
  }
1597
1468
 
1598
1469
  const resultConstructor = result.constructor
1599
1470
  if (typeof result == 'string' || resultConstructor == String) {
1600
1471
  // TODO: use array + join over adding
1601
- return genericReduce(args, transducer(add), result)
1472
+ return genericReduce(collection, transducer(add), result)
1602
1473
  }
1603
1474
  if (typeof result.concat == 'function') {
1604
- return genericReduce(args, transducer(callConcat), result)
1475
+ return genericReduce(collection, transducer(callConcat), result)
1605
1476
  }
1606
1477
  if (typeof result.write == 'function') {
1607
- return genericReduce(args, transducer(streamExtend), result)
1478
+ return genericReduce(collection, transducer(streamExtend), result)
1608
1479
  }
1609
1480
  if (resultConstructor == Set) {
1610
- return genericReduce(args, transducer(setExtend), result)
1481
+ return genericReduce(collection, transducer(setExtend), result)
1611
1482
  }
1612
1483
  if (resultConstructor == Object) {
1613
- return genericReduce(args, transducer(objectAssign), result)
1484
+ return genericReduce(collection, transducer(objectAssign), result)
1614
1485
  }
1615
- return identityTransform(args, transducer, result)
1486
+ return identityTransform(collection, transducer, result)
1616
1487
  }
1617
1488
 
1618
- const transform = function (transducer, init) {
1619
- if (typeof init == 'function') {
1620
- return function transforming(...args) {
1621
- const result = init(...args)
1622
- return isPromise(result)
1623
- ? result.then(curry3(genericTransform, args, transducer, __))
1624
- : genericTransform(args, transducer, result)
1625
- }
1489
+ // _transform(collection any, transducer function, initialValue function|any) -> Promise
1490
+ const _transform = function (collection, transducer, initialValue) {
1491
+ if (typeof initialValue == 'function') {
1492
+ const actualInitialValue = initialValue(collection)
1493
+ return isPromise(actualInitialValue)
1494
+ ? actualInitialValue.then(curry3(genericTransform, collection, transducer, __))
1495
+ : genericTransform(collection, transducer, actualInitialValue)
1496
+ }
1497
+ return isPromise(initialValue)
1498
+ ? initialValue.then(curry3(genericTransform, collection, transducer, __))
1499
+ : genericTransform(collection, transducer, initialValue)
1500
+ }
1501
+
1502
+ const transform = function (...args) {
1503
+ if (typeof args[0] == 'function') {
1504
+ return curry3(_transform, __, args[0], args[1])
1626
1505
  }
1627
- return function transforming(...args) {
1628
- return genericTransform(args, transducer, init)
1506
+ if (isPromise(args[0])) {
1507
+ return args[0].then(curry3(_transform, __, args[1], args[2]))
1629
1508
  }
1509
+ return _transform(args[0], args[1], args[2])
1630
1510
  }
1631
1511
 
1632
1512
  const arrayPush = function (array, value) {
@@ -1653,7 +1533,7 @@ const FlatMappingIterator = function (iterator, flatMapper) {
1653
1533
  return iteration
1654
1534
  }
1655
1535
  const monadAsArray = genericReduce(
1656
- [flatMapper(iteration.value)],
1536
+ flatMapper(iteration.value),
1657
1537
  arrayPush,
1658
1538
  []) // this will always have at least one item
1659
1539
  if (monadAsArray.length > 1) {
@@ -1697,12 +1577,12 @@ const FlatMappingAsyncIterator = function (asyncIterator, flatMapper) {
1697
1577
  } else {
1698
1578
  const monad = flatMapper(value)
1699
1579
  if (isPromise(monad)) {
1700
- const bufferLoading = monad.then(
1701
- curryArgs3(genericReduce, __, arrayPush, buffer))
1580
+ const bufferLoading =
1581
+ monad.then(curry3(genericReduce, __, arrayPush, buffer))
1702
1582
  const promise = bufferLoading.then(() => promises.delete(promise))
1703
1583
  promises.add(promise)
1704
1584
  } else {
1705
- const bufferLoading = genericReduce([monad], arrayPush, buffer)
1585
+ const bufferLoading = genericReduce(monad, arrayPush, buffer)
1706
1586
  if (isPromise(bufferLoading)) {
1707
1587
  const promise = bufferLoading.then(() => promises.delete(promise))
1708
1588
  promises.add(promise)
@@ -1726,6 +1606,12 @@ const getArg1 = (arg0, arg1) => arg1
1726
1606
 
1727
1607
  const identity = value => value
1728
1608
 
1609
+ const funcConcatSync = (
1610
+ funcA, funcB,
1611
+ ) => function pipedFunction(...args) {
1612
+ return funcB(funcA(...args))
1613
+ }
1614
+
1729
1615
  const asyncIteratorForEach = async function (asyncIterator, callback) {
1730
1616
  const promises = []
1731
1617
  for await (const item of asyncIterator) {
@@ -1912,177 +1798,120 @@ const stringFlatMap = function (string, flatMapper) {
1912
1798
  : arrayFlattenToString(monadArray)
1913
1799
  }
1914
1800
 
1915
- const streamWrite = function (stream, chunk, encoding, callback) {
1916
- stream.write(chunk, encoding, callback)
1917
- return stream
1918
- }
1919
-
1920
- const streamFlatExtend = async function (stream, item) {
1921
- const resultStreamWrite = curry2(streamWrite, stream, __),
1922
- // resultStreamWriteReducer = (_, subItem) => stream.write(subItem),
1923
- resultStreamWriteReducer = funcConcatSync(getArg1, resultStreamWrite),
1924
- promises = []
1925
- if (isArray(item)) {
1926
- const itemLength = item.length
1927
- let itemIndex = -1
1928
- while (++itemIndex < itemLength) {
1929
- stream.write(item[itemIndex])
1930
- }
1931
- } else if (item == null) {
1932
- stream.write(item)
1933
- } else if (typeof item[symbolIterator] == 'function') {
1934
- for (const subItem of item) {
1935
- stream.write(subItem)
1936
- }
1937
- } else if (typeof item[symbolAsyncIterator] == 'function') {
1938
- promises.push(
1939
- asyncIteratorForEach(item[symbolAsyncIterator](), resultStreamWrite))
1940
- } else if (typeof item.chain == 'function') {
1941
- const monadValue = item.chain(identity)
1942
- isPromise(monadValue)
1943
- ? promises.push(monadValue.then(resultStreamWrite))
1944
- : stream.write(monadValue)
1945
- } else if (typeof item.flatMap == 'function') {
1946
- const monadValue = item.flatMap(identity)
1947
- isPromise(monadValue)
1948
- ? promises.push(monadValue.then(resultStreamWrite))
1949
- : stream.write(monadValue)
1950
- } else if (typeof item.reduce == 'function') {
1951
- const folded = item.reduce(resultStreamWriteReducer, null)
1952
- isPromise(folded) && promises.push(folded)
1953
- } else if (item.constructor == Object) {
1954
- for (const key in item) {
1955
- stream.write(item[key])
1956
- }
1957
- } else {
1958
- stream.write(item)
1801
+ const _flatMap = function (value, flatMapper) {
1802
+ if (isArray(value)) {
1803
+ return arrayFlatMap(value, flatMapper)
1959
1804
  }
1960
- return promises.length == 0
1961
- ? stream
1962
- : promiseAll(promises).then(always(stream))
1963
- }
1964
-
1965
- const streamFlatMap = async function (stream, flatMapper) {
1966
- const promises = new Set()
1967
- for await (const item of stream) {
1968
- const monad = flatMapper(item)
1969
- if (isPromise(monad)) {
1970
- const selfDeletingPromise = monad.then(
1971
- curry2(streamFlatExtend, stream, __)).then(
1972
- () => promises.delete(selfDeletingPromise))
1973
- promises.add(selfDeletingPromise)
1974
- } else {
1975
- const streamFlatteningOperation = streamFlatExtend(stream, monad)
1976
- if (isPromise(streamFlatteningOperation)) {
1977
- const selfDeletingPromise = streamFlatteningOperation.then(
1978
- () => promises.delete(selfDeletingPromise))
1979
- promises.add(selfDeletingPromise)
1980
- }
1981
- }
1805
+ if (value == null) {
1806
+ return flatMapper(value)
1982
1807
  }
1983
- await promiseAll(promises)
1984
- return stream
1985
- }
1986
1808
 
1987
- const arrayJoinToBinary = function (array, init) {
1988
- const length = array.length
1989
- let index = -1,
1990
- result = init
1991
- while (++index < length) {
1992
- result = binaryExtend(result, array[index])
1809
+ if (typeof value.then == 'function') {
1810
+ return value.then(flatMapper)
1993
1811
  }
1994
- return result
1995
- }
1996
-
1997
- const arrayFlattenToBinary = function (array, result) {
1998
- const flattened = arrayFlatten(array)
1999
- return isPromise(flattened)
2000
- ? flattened.then(curry2(arrayJoinToBinary, __, result))
2001
- : arrayJoinToBinary(flattened, result)
2002
- }
2003
-
2004
- const binaryFlatMap = function (binary, flatMapper) {
2005
- const monadArray = arrayMap(binary, flatMapper),
2006
- result = globalThisHasBuffer && binary.constructor == Buffer
2007
- ? bufferAlloc(0)
2008
- : new binary.constructor(0)
2009
- return isPromise(monadArray)
2010
- ? monadArray.then(curry2(arrayFlattenToBinary, __, result))
2011
- : arrayFlattenToBinary(monadArray, result)
1812
+ if (typeof value.next == 'function') {
1813
+ return symbolIterator in value
1814
+ ? FlatMappingIterator(value, flatMapper)
1815
+ : FlatMappingAsyncIterator(value, flatMapper)
1816
+ }
1817
+ if (typeof value.chain == 'function') {
1818
+ return value.chain(flatMapper)
1819
+ }
1820
+ if (typeof value.flatMap == 'function') {
1821
+ return value.flatMap(flatMapper)
1822
+ }
1823
+ const valueConstructor = value.constructor
1824
+ if (valueConstructor == Object) {
1825
+ return objectFlatMap(value, flatMapper)
1826
+ }
1827
+ if (valueConstructor == Set) {
1828
+ return setFlatMap(value, flatMapper)
1829
+ }
1830
+ if (typeof value == 'string' || valueConstructor == String) {
1831
+ return stringFlatMap(value, flatMapper)
1832
+ }
1833
+ return flatMapper(value)
2012
1834
  }
2013
1835
 
2014
- const reducerFlatMap = (
2015
- reducer, flatMapper,
2016
- ) => function flatMappingReducer(result, value) {
2017
- const monad = flatMapper(value)
2018
- return isPromise(monad)
2019
- ? monad.then(curryArgs3(genericReduce, __, reducer, result))
2020
- : genericReduce([monad], reducer, result)
1836
+ const flatMap = (...args) => {
1837
+ const flatMapper = args.pop()
1838
+ if (args.length == 0) {
1839
+ return curry2(_flatMap, __, flatMapper)
1840
+ }
1841
+ const collection = args[0]
1842
+ return isPromise(collection)
1843
+ ? collection.then(curry2(_flatMap, __, flatMapper))
1844
+ : _flatMap(args[0], flatMapper)
2021
1845
  }
2022
1846
 
2023
- const generatorFunctionFlatMap = (
2024
- generatorFunction, flatMapper,
2025
- ) => function* flatMappingGeneratorFunction(...args) {
2026
- yield* FlatMappingIterator(generatorFunction(...args), flatMapper)
1847
+ const arrayForEach = function (array, callback) {
1848
+ const length = array.length,
1849
+ promises = []
1850
+ let index = -1
1851
+ while (++index < length) {
1852
+ const operation = callback(array[index])
1853
+ if (isPromise(operation)) {
1854
+ promises.push(operation)
1855
+ }
1856
+ }
1857
+ return promises.length == 0 ? array : promiseAll(promises).then(always(array))
2027
1858
  }
2028
1859
 
2029
- const asyncGeneratorFunctionFlatMap = (
2030
- asyncGeneratorFunction, flatMapper,
2031
- ) => async function* flatMappingAsyncGeneratorFunction(...args) {
2032
- yield* FlatMappingAsyncIterator(asyncGeneratorFunction(...args), flatMapper)
1860
+ const objectForEach = function (object, callback) {
1861
+ const promises = []
1862
+ for (const key in object) {
1863
+ const operation = callback(object[key])
1864
+ if (isPromise(operation)) {
1865
+ promises.push(operation)
1866
+ }
1867
+ }
1868
+ return promises.length == 0 ? object : promiseAll(promises).then(always(object))
2033
1869
  }
2034
1870
 
2035
- const flatMap = flatMapper => function flatMapping(value) {
2036
- if (isArray(value)) {
2037
- return arrayFlatMap(value, flatMapper)
2038
- }
2039
- if (typeof value == 'function') {
2040
- if (isGeneratorFunction(value)) {
2041
- return generatorFunctionFlatMap(value, flatMapper)
2042
- }
2043
- if (isAsyncGeneratorFunction(value)) {
2044
- return asyncGeneratorFunctionFlatMap(value, flatMapper)
1871
+ const iteratorForEach = function (iterator, callback) {
1872
+ const promises = []
1873
+ for (const item of iterator) {
1874
+ const operation = callback(item)
1875
+ if (isPromise(operation)) {
1876
+ promises.push(operation)
2045
1877
  }
2046
- return reducerFlatMap(value, flatMapper)
2047
- }
2048
- if (isBinary(value)) {
2049
- return binaryFlatMap(value, flatMapper)
2050
- }
2051
- if (value == null) {
2052
- return flatMapper(value)
2053
1878
  }
1879
+ return promises.length == 0 ? iterator : promiseAll(promises).then(always(iterator))
1880
+ }
2054
1881
 
2055
- if (typeof value.then == 'function') {
2056
- return value.then(flatMapper)
2057
- }
2058
- if (typeof value.next == 'function') {
2059
- return symbolIterator in value
2060
- ? FlatMappingIterator(value, flatMapper)
2061
- : FlatMappingAsyncIterator(value, flatMapper)
1882
+ // type Collection = Array|Iterable|AsyncIterable|{ forEach: function }|Object
1883
+ // _forEach(collection Collection, callback function) -> collection Collection
1884
+ const _forEach = function (collection, callback) {
1885
+ if (isArray(collection)) {
1886
+ return arrayForEach(collection, callback)
2062
1887
  }
2063
- if (typeof value.chain == 'function') {
2064
- return value.chain(flatMapper)
1888
+ if (collection == null) {
1889
+ return collection
2065
1890
  }
2066
- if (typeof value.flatMap == 'function') {
2067
- return value.flatMap(flatMapper)
1891
+ if (typeof collection.forEach == 'function') {
1892
+ return collection.forEach(callback)
2068
1893
  }
2069
- if (
2070
- typeof value[symbolAsyncIterator] == 'function'
2071
- && typeof value.write == 'function'
2072
- ) {
2073
- return streamFlatMap(value, flatMapper)
1894
+ if (typeof collection[symbolIterator] == 'function') {
1895
+ return iteratorForEach(collection[symbolIterator](), callback)
2074
1896
  }
2075
- const valueConstructor = value.constructor
2076
- if (valueConstructor == Object) {
2077
- return objectFlatMap(value, flatMapper)
1897
+ if (typeof collection[symbolAsyncIterator] == 'function') {
1898
+ return asyncIteratorForEach(collection[symbolAsyncIterator](), callback)
2078
1899
  }
2079
- if (valueConstructor == Set) {
2080
- return setFlatMap(value, flatMapper)
1900
+ if (collection.constructor == Object) {
1901
+ return objectForEach(collection, callback)
2081
1902
  }
2082
- if (typeof value == 'string' || valueConstructor == String) {
2083
- return stringFlatMap(value, flatMapper)
1903
+ return collection
1904
+ }
1905
+
1906
+ const forEach = function (...args) {
1907
+ const callback = args.pop()
1908
+ if (args.length == 0) {
1909
+ return curry2(_forEach, __, callback)
2084
1910
  }
2085
- return flatMapper(value)
1911
+ const collection = args[0]
1912
+ return isPromise(collection)
1913
+ ? collection.then(curry2(_forEach, __, callback))
1914
+ : _forEach(collection, callback)
2086
1915
  }
2087
1916
 
2088
1917
  const SelfReferencingPromise = function (basePromise) {
@@ -2090,7 +1919,7 @@ const SelfReferencingPromise = function (basePromise) {
2090
1919
  return promise
2091
1920
  }
2092
1921
 
2093
- const asyncArrayAny = async function (
1922
+ const asyncArraySome = async function (
2094
1923
  array, predicate, index, promisesInFlight,
2095
1924
  ) {
2096
1925
  const length = array.length
@@ -2113,13 +1942,13 @@ const asyncArrayAny = async function (
2113
1942
  return false
2114
1943
  }
2115
1944
 
2116
- const arrayAny = function (array, predicate) {
1945
+ const arraySome = function (array, predicate) {
2117
1946
  const length = array.length
2118
1947
  let index = -1
2119
1948
  while (++index < length) {
2120
1949
  const predication = predicate(array[index])
2121
1950
  if (isPromise(predication)) {
2122
- return asyncArrayAny(
1951
+ return asyncArraySome(
2123
1952
  array, predicate, index, new Set([SelfReferencingPromise(predication)]))
2124
1953
  }
2125
1954
  if (predication) {
@@ -2129,7 +1958,7 @@ const arrayAny = function (array, predicate) {
2129
1958
  return false
2130
1959
  }
2131
1960
 
2132
- const asyncIteratorAny = async function (
1961
+ const asyncIteratorSome = async function (
2133
1962
  iterator, predicate, promisesInFlight, maxConcurrency = 20,
2134
1963
  ) {
2135
1964
  let iteration = iterator.next()
@@ -2166,11 +1995,11 @@ const asyncIteratorAny = async function (
2166
1995
  return false
2167
1996
  }
2168
1997
 
2169
- const iteratorAny = function (iterator, predicate) {
1998
+ const iteratorSome = function (iterator, predicate) {
2170
1999
  for (const item of iterator) {
2171
2000
  const predication = predicate(item)
2172
2001
  if (isPromise(predication)) {
2173
- return asyncIteratorAny(
2002
+ return asyncIteratorSome(
2174
2003
  iterator, predicate, new Set([SelfReferencingPromise(predication)]))
2175
2004
  }
2176
2005
  if (predication) {
@@ -2184,35 +2013,52 @@ const reducerAnySync = predicate => function anyReducer(result, item) {
2184
2013
  return result ? true : predicate(item)
2185
2014
  }
2186
2015
 
2187
- const reducerAny = predicate => function anyReducer(result, item) {
2016
+ const reducerSome = predicate => function anyReducer(result, item) {
2188
2017
  return result === true ? result
2189
2018
  : isPromise(result) ? result.then(curry2(reducerAnySync(predicate), __, item))
2190
2019
  : result ? true : predicate(item)
2191
2020
  }
2192
2021
 
2193
- const any = predicate => function anyTruthy(value) {
2194
- if (isArray(value)) {
2195
- return arrayAny(value, predicate)
2022
+ // _some(collection Array|Iterable|AsyncIterable|{ reduce: function }|Object, predicate function) -> Promise|boolean
2023
+ const _some = function (collection, predicate) {
2024
+ if (isArray(collection)) {
2025
+ return arraySome(collection, predicate)
2196
2026
  }
2197
- if (value == null) {
2198
- return predicate(value)
2027
+ if (collection == null) {
2028
+ return predicate(collection)
2199
2029
  }
2200
- if (typeof value[symbolIterator] == 'function') {
2201
- return iteratorAny(value[symbolIterator](), predicate)
2030
+ if (typeof collection[symbolIterator] == 'function') {
2031
+ return iteratorSome(collection[symbolIterator](), predicate)
2202
2032
  }
2203
- if (typeof value[symbolAsyncIterator] == 'function') {
2204
- return asyncIteratorAny(value[symbolAsyncIterator](), predicate, new Set())
2033
+ if (typeof collection[symbolAsyncIterator] == 'function') {
2034
+ return asyncIteratorSome(
2035
+ collection[symbolAsyncIterator](), predicate, new Set()
2036
+ )
2205
2037
  }
2206
- if (typeof value.reduce == 'function') {
2207
- return value.reduce(reducerAny(predicate), false)
2038
+ if (typeof collection.reduce == 'function') {
2039
+ return collection.reduce(reducerSome(predicate), false)
2208
2040
  }
2209
- if (value.constructor == Object) {
2210
- return arrayAny(objectValues(value), predicate)
2041
+ if (collection.constructor == Object) {
2042
+ return arraySome(objectValues(collection), predicate)
2043
+ }
2044
+ return predicate(collection)
2045
+ }
2046
+
2047
+ const some = function (...args) {
2048
+ const predicate = args.pop()
2049
+ if (args.length == 0) {
2050
+ return curry2(_some, __, predicate)
2051
+ }
2052
+
2053
+ const collection = args[0]
2054
+ if (isPromise(collection)) {
2055
+ return collection.then(curry2(_some, __, predicate))
2211
2056
  }
2212
- return predicate(value)
2057
+
2058
+ return _some(collection, predicate)
2213
2059
  }
2214
2060
 
2215
- const arrayAll = function (array, predicate) {
2061
+ const arrayEvery = function (array, predicate) {
2216
2062
  const arrayLength = array.length,
2217
2063
  promises = []
2218
2064
  let index = -1
@@ -2229,7 +2075,7 @@ const arrayAll = function (array, predicate) {
2229
2075
  : promiseAll(promises).then(curry3(callPropUnary, __, 'every', Boolean))
2230
2076
  }
2231
2077
 
2232
- const iteratorAll = function (iterator, predicate) {
2078
+ const iteratorEvery = function (iterator, predicate) {
2233
2079
  const promises = []
2234
2080
  for (const item of iterator) {
2235
2081
  const predication = predicate(item)
@@ -2244,7 +2090,7 @@ const iteratorAll = function (iterator, predicate) {
2244
2090
  : promiseAll(promises).then(curry3(callPropUnary, __, 'every', Boolean))
2245
2091
  }
2246
2092
 
2247
- const asyncIteratorAll = async function (
2093
+ const asyncIteratorEvery = async function (
2248
2094
  asyncIterator, predicate, promisesInFlight, maxConcurrency = 20,
2249
2095
  ) {
2250
2096
  let iteration = await asyncIterator.next()
@@ -2277,45 +2123,62 @@ const asyncIteratorAll = async function (
2277
2123
 
2278
2124
  const reducerAllSync = (predicate, result, item) => result ? predicate(item) : false
2279
2125
 
2280
- const reducerAll = predicate => function allReducer(result, item) {
2126
+ const reducerEvery = predicate => function allReducer(result, item) {
2281
2127
  return result === false ? false
2282
2128
  : isPromise(result) ? result.then(
2283
2129
  curry3(reducerAllSync, predicate, __, item))
2284
2130
  : result ? predicate(item) : false
2285
2131
  }
2286
2132
 
2287
- const all = predicate => function allTruthy(value) {
2288
- if (isArray(value)) {
2289
- return arrayAll(value, predicate)
2133
+ // _every(collection Array|Iterable|AsyncIterable|{ reduce: function }|Object, predicate function) -> Promise|boolean
2134
+ const _every = function (collection, predicate) {
2135
+ if (isArray(collection)) {
2136
+ return arrayEvery(collection, predicate)
2290
2137
  }
2291
- if (value == null) {
2292
- return predicate(value)
2138
+ if (collection == null) {
2139
+ return predicate(collection)
2293
2140
  }
2294
2141
 
2295
- if (typeof value[symbolIterator] == 'function') {
2296
- return iteratorAll(value[symbolIterator](), predicate)
2142
+ if (typeof collection[symbolIterator] == 'function') {
2143
+ return iteratorEvery(collection[symbolIterator](), predicate)
2297
2144
  }
2298
- if (typeof value[symbolAsyncIterator] == 'function') {
2299
- return asyncIteratorAll(value[symbolAsyncIterator](), predicate, new Set())
2145
+ if (typeof collection[symbolAsyncIterator] == 'function') {
2146
+ return asyncIteratorEvery(
2147
+ collection[symbolAsyncIterator](), predicate, new Set()
2148
+ )
2300
2149
  }
2301
- if (typeof value.reduce == 'function') {
2302
- return value.reduce(reducerAll(predicate), true)
2150
+ if (typeof collection.reduce == 'function') {
2151
+ return collection.reduce(reducerEvery(predicate), true)
2303
2152
  }
2304
- if (value.constructor == Object) {
2305
- return arrayAll(objectValues(value), predicate)
2153
+ if (collection.constructor == Object) {
2154
+ return arrayEvery(objectValues(collection), predicate)
2306
2155
  }
2307
- return predicate(value)
2156
+ return predicate(collection)
2157
+ }
2158
+
2159
+ const every = function (...args) {
2160
+ const predicate = args.pop()
2161
+ if (args.length == 0) {
2162
+ return curry2(_every, __, predicate)
2163
+ }
2164
+
2165
+ const collection = args[0]
2166
+ if (isPromise(collection)) {
2167
+ return collection.then(curry2(_every, __, predicate))
2168
+ }
2169
+
2170
+ return _every(collection, predicate)
2308
2171
  }
2309
2172
 
2310
- const areAllNonfunctionsTruthy = function (predicates, index) {
2173
+ const areAllValuesTruthy = function (predicates, index) {
2311
2174
  const length = predicates.length
2312
2175
  while (++index < length) {
2313
- let predicate = predicates[index]
2176
+ const predicate = predicates[index]
2314
2177
  if (isPromise(predicate)) {
2315
2178
  return predicate.then(curry3(
2316
2179
  thunkConditional,
2317
2180
  __,
2318
- thunkify2(areAllNonfunctionsTruthy, predicates, index),
2181
+ thunkify2(areAllValuesTruthy, predicates, index),
2319
2182
  always(false),
2320
2183
  ))
2321
2184
  }
@@ -2326,12 +2189,12 @@ const areAllNonfunctionsTruthy = function (predicates, index) {
2326
2189
  return true
2327
2190
  }
2328
2191
 
2329
- const asyncArePredicatesAllTruthy = async function (predicates, point, index) {
2192
+ const asyncArePredicatesAllTruthy = async function (args, predicates, index) {
2330
2193
  const length = predicates.length
2331
2194
  while (++index < length) {
2332
2195
  let predicate = predicates[index]
2333
2196
  if (typeof predicate == 'function') {
2334
- predicate = predicate(point)
2197
+ predicate = predicate(...args)
2335
2198
  }
2336
2199
  if (isPromise(predicate)) {
2337
2200
  predicate = await predicate
@@ -2343,39 +2206,53 @@ const asyncArePredicatesAllTruthy = async function (predicates, point, index) {
2343
2206
  return true
2344
2207
  }
2345
2208
 
2346
- const and = predicates => {
2347
- if (areAllValuesNonfunctions(predicates)) {
2348
- return areAllNonfunctionsTruthy(predicates, -1)
2349
- }
2350
- return function arePredicatesAllTruthy(point) {
2351
- const length = predicates.length
2352
- let index = -1
2209
+ // areAllPredicatesTruthy(args Array, predicates Array<function>) -> Promise|boolean
2210
+ const areAllPredicatesTruthy = function (args, predicates) {
2211
+ const length = predicates.length
2212
+ let index = -1
2353
2213
 
2354
- while (++index < length) {
2355
- let predicate = predicates[index]
2356
- if (typeof predicate == 'function') {
2357
- predicate = predicate(point)
2358
- }
2359
- if (isPromise(predicate)) {
2360
- return predicate.then(curry3(
2361
- thunkConditional,
2362
- __,
2363
- thunkify3(asyncArePredicatesAllTruthy, predicates, point, index),
2364
- always(false),
2365
- ))
2366
- }
2367
- if (!predicate) {
2368
- return false
2369
- }
2214
+ while (++index < length) {
2215
+ let predicate = predicates[index]
2216
+ if (typeof predicate == 'function') {
2217
+ predicate = predicate(...args)
2218
+ }
2219
+ if (isPromise(predicate)) {
2220
+ return predicate.then(curry3(
2221
+ thunkConditional,
2222
+ __,
2223
+ thunkify3(asyncArePredicatesAllTruthy, args, predicates, index),
2224
+ always(false),
2225
+ ))
2226
+ }
2227
+ if (!predicate) {
2228
+ return false
2370
2229
  }
2371
- return true
2372
2230
  }
2231
+ return true
2232
+ }
2233
+
2234
+ const and = function (...args) {
2235
+ const predicatesOrValues = args.pop()
2236
+ if (areAllValuesNonfunctions(predicatesOrValues)) {
2237
+ return areAllValuesTruthy(predicatesOrValues, -1)
2238
+ }
2239
+
2240
+ if (args.length == 0) {
2241
+ return curryArgs2(areAllPredicatesTruthy, __, predicatesOrValues)
2242
+ }
2243
+
2244
+ if (areAnyValuesPromises(args)) {
2245
+ return promiseAll(args)
2246
+ .then(curry2(areAllPredicatesTruthy, __, predicatesOrValues))
2247
+ }
2248
+
2249
+ return areAllPredicatesTruthy(args, predicatesOrValues)
2373
2250
  }
2374
2251
 
2375
2252
  const areAnyNonfunctionsTruthy = function (predicates, index) {
2376
2253
  const length = predicates.length
2377
2254
  while (++index < length) {
2378
- let predicate = predicates[index]
2255
+ const predicate = predicates[index]
2379
2256
  if (isPromise(predicate)) {
2380
2257
  return predicate.then(curry3(
2381
2258
  thunkConditional,
@@ -2391,14 +2268,13 @@ const areAnyNonfunctionsTruthy = function (predicates, index) {
2391
2268
  return false
2392
2269
  }
2393
2270
 
2394
- const asyncAreAnyPredicatesTruthy = async function (predicates, point, index) {
2271
+ const asyncAreAnyPredicatesTruthy = async function (args, predicates, index) {
2395
2272
  const length = predicates.length
2396
2273
  while (++index < length) {
2397
2274
  let predicate = predicates[index]
2398
2275
  if (typeof predicate == 'function') {
2399
- predicate = predicate(point)
2276
+ predicate = predicate(...args)
2400
2277
  }
2401
- console.log('hey - or', predicate)
2402
2278
  if (isPromise(predicate)) {
2403
2279
  predicate = await predicate
2404
2280
  }
@@ -2409,275 +2285,225 @@ const asyncAreAnyPredicatesTruthy = async function (predicates, point, index) {
2409
2285
  return false
2410
2286
  }
2411
2287
 
2412
- const or = predicates => {
2413
- if (areAllValuesNonfunctions(predicates)) {
2414
- return areAnyNonfunctionsTruthy(predicates, -1)
2415
- }
2416
- return function areAnyPredicatesTruthy(point) {
2417
- const length = predicates.length
2418
- let index = -1
2288
+ // areAnyPredicatesTruthy(args Array, predicates Array<function>) -> Promise|boolean
2289
+ const areAnyPredicatesTruthy = function (args, predicates) {
2290
+ const length = predicates.length
2291
+ let index = -1
2419
2292
 
2420
- while (++index < length) {
2421
- let predicate = predicates[index]
2422
- if (typeof predicate == 'function') {
2423
- predicate = predicate(point)
2424
- }
2425
- if (isPromise(predicate)) {
2426
- return predicate.then(curry3(
2427
- thunkConditional,
2428
- __,
2429
- always(true),
2430
- thunkify3(asyncAreAnyPredicatesTruthy, predicates, point, index),
2431
- ))
2432
- }
2433
- if (predicate) {
2434
- return true
2435
- }
2293
+ while (++index < length) {
2294
+ let predicate = predicates[index]
2295
+ if (typeof predicate == 'function') {
2296
+ predicate = predicate(...args)
2297
+ }
2298
+ if (isPromise(predicate)) {
2299
+ return predicate.then(curry3(
2300
+ thunkConditional,
2301
+ __,
2302
+ always(true),
2303
+ thunkify3(asyncAreAnyPredicatesTruthy, args, predicates, index),
2304
+ ))
2305
+ }
2306
+ if (predicate) {
2307
+ return true
2436
2308
  }
2437
- return false
2438
2309
  }
2310
+ return false
2439
2311
  }
2440
2312
 
2441
- // true -> false
2442
- const _not = value => !value
2443
-
2444
- const not = function (funcOrValue) {
2445
- if (typeof funcOrValue == 'function') {
2446
- return function logicalInverter(value) {
2447
- const boolean = funcOrValue(value)
2448
- return isPromise(boolean) ? boolean.then(_not) : !boolean
2449
- }
2313
+ const or = function (...args) {
2314
+ const predicatesOrValues = args.pop()
2315
+ if (areAllValuesNonfunctions(predicatesOrValues)) {
2316
+ return areAnyNonfunctionsTruthy(predicatesOrValues, -1)
2450
2317
  }
2451
- return !funcOrValue
2452
- }
2453
2318
 
2454
- const notSync = func => function notSync(...args) {
2455
- return !func(...args)
2456
- }
2319
+ if (args.length == 0) {
2320
+ return curryArgs2(areAnyPredicatesTruthy, __, predicatesOrValues)
2321
+ }
2457
2322
 
2458
- not.sync = notSync
2323
+ if (areAnyValuesPromises(args)) {
2324
+ return promiseAll(args)
2325
+ .then(curry2(areAnyPredicatesTruthy, __, predicatesOrValues))
2326
+ }
2459
2327
 
2460
- const sameValueZero = function (left, right) {
2461
- return left === right || (left !== left && right !== right)
2328
+ return areAnyPredicatesTruthy(args, predicatesOrValues)
2462
2329
  }
2463
2330
 
2464
- const eq = function (left, right) {
2465
- const isLeftResolver = typeof left == 'function',
2466
- isRightResolver = typeof right == 'function'
2331
+ // negate(value boolean) -> inverse boolean
2332
+ const negate = value => !value
2467
2333
 
2468
- if (isLeftResolver && isRightResolver) {
2469
- return function equalBy(value) {
2470
- const leftResolve = left(value),
2471
- rightResolve = right(value)
2472
- const isLeftPromise = isPromise(leftResolve),
2473
- isRightPromise = isPromise(rightResolve)
2474
- if (isLeftPromise && isRightPromise) {
2475
- return promiseAll(
2476
- [leftResolve, rightResolve]).then(spread2(sameValueZero))
2477
- } else if (isLeftPromise) {
2478
- return leftResolve.then(curry2(sameValueZero, __, rightResolve))
2479
- } else if (isRightPromise) {
2480
- return rightResolve.then(curry2(sameValueZero, leftResolve, __))
2481
- }
2482
- return sameValueZero(leftResolve, rightResolve)
2483
- }
2484
- }
2334
+ // _not(args Array, predicate function)
2335
+ const _not = function (args, predicate) {
2336
+ const boolean = predicate(...args)
2337
+ return isPromise(boolean) ? boolean.then(negate) : !boolean
2338
+ }
2485
2339
 
2486
- if (isLeftResolver) {
2487
- return function equalBy(value) {
2488
- const leftResolve = left(value)
2489
- return isPromise(leftResolve)
2490
- ? leftResolve.then(curry2(sameValueZero, __, right))
2491
- : sameValueZero(leftResolve, right)
2340
+ const not = function (...args) {
2341
+ const predicateOrValue = args.pop()
2342
+ if (typeof predicateOrValue == 'function') {
2343
+ if (args.length == 0) {
2344
+ return curryArgs2(_not, __, predicateOrValue)
2492
2345
  }
2493
- }
2494
- if (isRightResolver) {
2495
- return function equalBy(value) {
2496
- const rightResolve = right(value)
2497
- return isPromise(rightResolve)
2498
- ? rightResolve.then(curry2(sameValueZero, left, __))
2499
- : sameValueZero(left, rightResolve)
2346
+ if (areAnyValuesPromises(args)) {
2347
+ return promiseAll(args).then(curry2(_not, __, predicateOrValue))
2500
2348
  }
2349
+ return _not(args, predicateOrValue)
2501
2350
  }
2351
+ return !predicateOrValue
2352
+ }
2502
2353
 
2503
- return sameValueZero(left, right)
2354
+ // argument resolver for curryArgs4
2355
+ const curryArgs4ResolveArgs0 = (
2356
+ baseFunc, arg1, arg2, arg3,
2357
+ ) => function args0Resolver(...args) {
2358
+ return baseFunc(args, arg1, arg2, arg3)
2504
2359
  }
2505
2360
 
2506
- const greaterThan = (left, right) => left > right
2361
+ // argument resolver for curryArgs4
2362
+ const curryArgs4ResolveArgs1 = (
2363
+ baseFunc, arg0, arg2, arg3,
2364
+ ) => function args1Resolver(...args) {
2365
+ return baseFunc(arg0, args, arg2, arg3)
2366
+ }
2507
2367
 
2508
- const gt = function (left, right) {
2509
- const isLeftResolver = typeof left == 'function',
2510
- isRightResolver = typeof right == 'function'
2368
+ // argument resolver for curryArgs4
2369
+ const curryArgs4ResolveArgs2 = (
2370
+ baseFunc, arg0, arg1, arg3,
2371
+ ) => function args2Resolver(...args) {
2372
+ return baseFunc(arg0, arg1, args, arg3)
2373
+ }
2511
2374
 
2512
- if (isLeftResolver && isRightResolver) {
2513
- return function greaterThanBy(value) {
2514
- const leftResolve = left(value),
2515
- rightResolve = right(value)
2516
- const isLeftPromise = isPromise(leftResolve),
2517
- isRightPromise = isPromise(rightResolve)
2518
- if (isLeftPromise && isRightPromise) {
2519
- return promiseAll(
2520
- [leftResolve, rightResolve]).then(spread2(greaterThan))
2521
- } else if (isLeftPromise) {
2522
- return leftResolve.then(curry2(greaterThan, __, rightResolve))
2523
- } else if (isRightPromise) {
2524
- return rightResolve.then(curry2(greaterThan, leftResolve, __))
2525
- }
2526
- return leftResolve > rightResolve
2527
- }
2528
- }
2375
+ // argument resolver for curryArgs4
2376
+ const curryArgs4ResolveArgs3 = (
2377
+ baseFunc, arg0, arg1, arg2,
2378
+ ) => function args3Resolver(...args) {
2379
+ return baseFunc(arg0, arg1, arg2, args)
2380
+ }
2529
2381
 
2530
- if (isLeftResolver) {
2531
- return function greaterThanBy(value) {
2532
- const leftResolve = left(value)
2533
- return isPromise(leftResolve)
2534
- ? leftResolve.then(curry2(greaterThan, __, right))
2535
- : leftResolve > right
2536
- }
2382
+ const curryArgs4 = function (baseFunc, arg0, arg1, arg2, arg3) {
2383
+ if (arg0 == __) {
2384
+ return curryArgs4ResolveArgs0(baseFunc, arg1, arg2, arg3)
2537
2385
  }
2538
- if (isRightResolver) {
2539
- return function strictEqualBy(value) {
2540
- const rightResolve = right(value)
2541
- return isPromise(rightResolve)
2542
- ? rightResolve.then(curry2(greaterThan, left, __))
2543
- : left > rightResolve
2544
- }
2386
+ if (arg1 == __) {
2387
+ return curryArgs4ResolveArgs1(baseFunc, arg0, arg2, arg3)
2388
+ }
2389
+ if (arg2 == __) {
2390
+ return curryArgs4ResolveArgs2(baseFunc, arg0, arg1, arg3)
2391
+ }
2392
+ return curryArgs4ResolveArgs3(baseFunc, arg0, arg1, arg2)
2393
+ }
2394
+
2395
+ // leftResolverRightResolverCompare(
2396
+ // args Array, comparator function, left function, right function,
2397
+ // ) -> Promise|boolean
2398
+ const leftResolverRightResolverCompare = function (
2399
+ args, comparator, left, right,
2400
+ ) {
2401
+ const leftResult = left(...args),
2402
+ rightResult = right(...args)
2403
+ if (isPromise(leftResult) || isPromise(rightResult)) {
2404
+ return promiseAll([leftResult, rightResult]).then(spread2(comparator))
2545
2405
  }
2406
+ return comparator(leftResult, rightResult)
2407
+ }
2546
2408
 
2547
- return left > right
2409
+ // leftResolverRightValueCompare(
2410
+ // args Array, comparator function, left function, right any
2411
+ // ) -> Promise|boolean
2412
+ const leftResolverRightValueCompare = function (args, comparator, left, right) {
2413
+ const leftResult = left(...args)
2414
+ if (isPromise(leftResult) || isPromise(right)) {
2415
+ return promiseAll([leftResult, right]).then(spread2(comparator))
2416
+ }
2417
+ return comparator(leftResult, right)
2548
2418
  }
2549
2419
 
2550
- const lessThan = (left, right) => left < right
2420
+ // leftValueRightResolverCompare(
2421
+ // args Array, comparator function, left any, right any,
2422
+ // ) -> Promise|boolean
2423
+ const leftValueRightResolverCompare = function (args, comparator, left, right) {
2424
+ const rightResult = right(...args)
2425
+ if (isPromise(left) || isPromise(rightResult)) {
2426
+ return promiseAll([left, rightResult]).then(spread2(comparator))
2427
+ }
2428
+ return comparator(left, rightResult)
2429
+ }
2551
2430
 
2552
- const lt = function (left, right) {
2431
+ // ComparisonOperator(comparator function) -> operator function
2432
+ const ComparisonOperator = comparator => function operator(...args) {
2433
+ const right = args.pop()
2434
+ const left = args.pop()
2553
2435
  const isLeftResolver = typeof left == 'function',
2554
2436
  isRightResolver = typeof right == 'function'
2555
2437
 
2556
2438
  if (isLeftResolver && isRightResolver) {
2557
- return function lessThanBy(value) {
2558
- const leftResolve = left(value),
2559
- rightResolve = right(value)
2560
- const isLeftPromise = isPromise(leftResolve),
2561
- isRightPromise = isPromise(rightResolve)
2562
- if (isLeftPromise && isRightPromise) {
2563
- return promiseAll(
2564
- [leftResolve, rightResolve]).then(spread2(lessThan))
2565
- } else if (isLeftPromise) {
2566
- return leftResolve.then(curry2(lessThan, __, rightResolve))
2567
- } else if (isRightPromise) {
2568
- return rightResolve.then(curry2(lessThan, leftResolve, __))
2569
- }
2570
- return leftResolve < rightResolve
2439
+ if (args.length == 0) {
2440
+ return curryArgs4(
2441
+ leftResolverRightResolverCompare, __, comparator, left, right,
2442
+ )
2571
2443
  }
2444
+ if (areAnyValuesPromises(args)) {
2445
+ return promiseAll(args).then(curry4(
2446
+ leftResolverRightResolverCompare, __, comparator, left, right,
2447
+ ))
2448
+ }
2449
+ return leftResolverRightResolverCompare(args, comparator, left, right)
2572
2450
  }
2573
2451
 
2574
2452
  if (isLeftResolver) {
2575
- return function lessThanBy(value) {
2576
- const leftResolve = left(value)
2577
- return isPromise(leftResolve)
2578
- ? leftResolve.then(curry2(lessThan, __, right))
2579
- : leftResolve < right
2453
+ if (args.length == 0) {
2454
+ return curryArgs4(
2455
+ leftResolverRightValueCompare, __, comparator, left, right,
2456
+ )
2457
+ }
2458
+ if (areAnyValuesPromises(args)) {
2459
+ return promiseAll(args).then(curry4(
2460
+ leftResolverRightValueCompare, __, comparator, left, right,
2461
+ ))
2580
2462
  }
2463
+ return leftResolverRightValueCompare(args, comparator, left, right)
2581
2464
  }
2465
+
2582
2466
  if (isRightResolver) {
2583
- return function lessThanBy(value) {
2584
- const rightResolve = right(value)
2585
- return isPromise(rightResolve)
2586
- ? rightResolve.then(curry2(lessThan, left, __))
2587
- : left < rightResolve
2467
+ if (args.length == 0) {
2468
+ return curryArgs4(
2469
+ leftValueRightResolverCompare, __, comparator, left, right,
2470
+ )
2471
+ }
2472
+ if (areAnyValuesPromises(args)) {
2473
+ return promiseAll(args).then(curry4(
2474
+ leftValueRightResolverCompare, __, comparator, left, right,
2475
+ ))
2588
2476
  }
2477
+ return leftValueRightResolverCompare(args, comparator, left, right)
2589
2478
  }
2590
2479
 
2591
- return left < right
2480
+ if (isPromise(left) || isPromise(right)) {
2481
+ return promiseAll([left, right]).then(spread2(comparator))
2482
+ }
2483
+ return comparator(left, right)
2592
2484
  }
2593
2485
 
2594
- const greaterThanOrEqual = (left, right) => left >= right
2486
+ const equals = function (left, right) {
2487
+ return left == right
2488
+ }
2595
2489
 
2596
- const gte = function (left, right) {
2597
- const isLeftResolver = typeof left == 'function',
2598
- isRightResolver = typeof right == 'function'
2490
+ const eq = ComparisonOperator(equals)
2599
2491
 
2600
- if (isLeftResolver && isRightResolver) {
2601
- return function greaterThanOrEqualBy(value) {
2602
- const leftResolve = left(value),
2603
- rightResolve = right(value)
2604
- const isLeftPromise = isPromise(leftResolve),
2605
- isRightPromise = isPromise(rightResolve)
2606
- if (isLeftPromise && isRightPromise) {
2607
- return promiseAll(
2608
- [leftResolve, rightResolve]).then(spread2(greaterThanOrEqual))
2609
- } else if (isLeftPromise) {
2610
- return leftResolve.then(curry2(greaterThanOrEqual, __, rightResolve))
2611
- } else if (isRightPromise) {
2612
- return rightResolve.then(curry2(greaterThanOrEqual, leftResolve, __))
2613
- }
2614
- return leftResolve >= rightResolve
2615
- }
2616
- }
2492
+ const greaterThan = (left, right) => left > right
2617
2493
 
2618
- if (isLeftResolver) {
2619
- return function greaterThanOrEqualBy(value) {
2620
- const leftResolve = left(value)
2621
- return isPromise(leftResolve)
2622
- ? leftResolve.then(curry2(greaterThanOrEqual, __, right))
2623
- : leftResolve >= right
2624
- }
2625
- }
2626
- if (isRightResolver) {
2627
- return function greaterThanOrEqualBy(value) {
2628
- const rightResolve = right(value)
2629
- return isPromise(rightResolve)
2630
- ? rightResolve.then(curry2(greaterThanOrEqual, left, __))
2631
- : left >= rightResolve
2632
- }
2633
- }
2494
+ const gt = ComparisonOperator(greaterThan)
2634
2495
 
2635
- return left >= right
2636
- }
2496
+ const lessThan = (left, right) => left < right
2637
2497
 
2638
- const lessThanOrEqual = (left, right) => left <= right
2498
+ const lt = ComparisonOperator(lessThan)
2639
2499
 
2640
- const lte = function (left, right) {
2641
- const isLeftResolver = typeof left == 'function',
2642
- isRightResolver = typeof right == 'function'
2500
+ const greaterThanOrEqual = (left, right) => left >= right
2643
2501
 
2644
- if (isLeftResolver && isRightResolver) {
2645
- return function lessThanOrEqualBy(value) {
2646
- const leftResolve = left(value),
2647
- rightResolve = right(value)
2648
- const isLeftPromise = isPromise(leftResolve),
2649
- isRightPromise = isPromise(rightResolve)
2650
- if (isLeftPromise && isRightPromise) {
2651
- return promiseAll(
2652
- [leftResolve, rightResolve]).then(spread2(lessThanOrEqual))
2653
- } else if (isLeftPromise) {
2654
- return leftResolve.then(curry2(lessThanOrEqual, __, rightResolve))
2655
- } else if (isRightPromise) {
2656
- return rightResolve.then(curry2(lessThanOrEqual, leftResolve, __))
2657
- }
2658
- return leftResolve <= rightResolve
2659
- }
2660
- }
2502
+ const gte = ComparisonOperator(greaterThanOrEqual)
2661
2503
 
2662
- if (isLeftResolver) {
2663
- return function lessThanOrEqualBy(value) {
2664
- const leftResolve = left(value)
2665
- return isPromise(leftResolve)
2666
- ? leftResolve.then(curry2(lessThanOrEqual, __, right))
2667
- : leftResolve <= right
2668
- }
2669
- }
2670
- if (isRightResolver) {
2671
- return function lessThanOrEqualBy(value) {
2672
- const rightResolve = right(value)
2673
- return isPromise(rightResolve)
2674
- ? rightResolve.then(curry2(lessThanOrEqual, left, __))
2675
- : left <= rightResolve
2676
- }
2677
- }
2504
+ const lessThanOrEqual = (left, right) => left <= right
2678
2505
 
2679
- return left <= right
2680
- }
2506
+ const lte = ComparisonOperator(lessThanOrEqual)
2681
2507
 
2682
2508
  const memoizeCappedUnary = function (func, cap) {
2683
2509
  const cache = new Map(),
@@ -2737,13 +2563,24 @@ const getByPath = function (value, path) {
2737
2563
  return result
2738
2564
  }
2739
2565
 
2740
- const get = (path, defaultValue) => function getter(value) {
2741
- const result = value == null ? undefined : getByPath(value, path)
2566
+ // _get(object Object, path string, defaultValue function|any)
2567
+ const _get = function (object, path, defaultValue) {
2568
+ const result = object == null ? undefined : getByPath(object, path)
2742
2569
  return result === undefined
2743
- ? typeof defaultValue == 'function' ? defaultValue(value) : defaultValue
2570
+ ? typeof defaultValue == 'function' ? defaultValue(object) : defaultValue
2744
2571
  : result
2745
2572
  }
2746
2573
 
2574
+ const get = function (arg0, arg1, arg2) {
2575
+ if (isPromise(arg0)) {
2576
+ return arg0.then(curry3(_get, __, arg1, arg2))
2577
+ }
2578
+ if (isObject(arg0) && !isArray(arg0)) {
2579
+ return _get(arg0, arg1, arg2)
2580
+ }
2581
+ return curry3(_get, __, arg0, arg1)
2582
+ }
2583
+
2747
2584
  const setByPath = function (obj, value, path) {
2748
2585
  if (!isObject(obj)){
2749
2586
  return obj
@@ -2769,7 +2606,7 @@ const setByPath = function (obj, value, path) {
2769
2606
  return result
2770
2607
  }
2771
2608
 
2772
- const set = (path, value) => function setter(obj) {
2609
+ const _set = function (obj, path, value) {
2773
2610
  if (typeof value == 'function') {
2774
2611
  const actualValue = value(obj)
2775
2612
  if (isPromise(actualValue)) {
@@ -2779,9 +2616,24 @@ const set = (path, value) => function setter(obj) {
2779
2616
  }
2780
2617
  return setByPath(obj, actualValue, path)
2781
2618
  }
2619
+ if (isPromise(value)) {
2620
+ return value.then(
2621
+ curry3(setByPath, obj, __, path)
2622
+ )
2623
+ }
2782
2624
  return setByPath(obj, value, path)
2783
2625
  }
2784
2626
 
2627
+ const set = function (arg0, arg1, arg2) {
2628
+ if (arg2 == null) {
2629
+ return curry3(_set, __, arg0, arg1)
2630
+ }
2631
+ if (isPromise(arg0)) {
2632
+ return arg0.then(curry3(_set, __, arg1, arg2))
2633
+ }
2634
+ return _set(arg0, arg1, arg2)
2635
+ }
2636
+
2785
2637
  // _pick(source Object, keys Array<string>) -> result Object
2786
2638
  const _pick = function (source, keys) {
2787
2639
  if (source == null) {
@@ -2800,10 +2652,13 @@ const _pick = function (source, keys) {
2800
2652
  return result
2801
2653
  }
2802
2654
 
2803
- const pick = (arg0, arg1) => {
2655
+ const pick = function (arg0, arg1) {
2804
2656
  if (arg1 == null) {
2805
2657
  return curry2(_pick, __, arg0)
2806
2658
  }
2659
+ if (isPromise(arg0)) {
2660
+ return arg0.then(curry2(_pick, __, arg1))
2661
+ }
2807
2662
  return _pick(arg0, arg1)
2808
2663
  }
2809
2664
 
@@ -2890,10 +2745,16 @@ const omit = function (arg0, arg1) {
2890
2745
  if (arg1 == null) {
2891
2746
  return curry2(_omit, __, arg0)
2892
2747
  }
2748
+ if (isPromise(arg0)) {
2749
+ return arg0.then(curry2(_omit, __, arg1))
2750
+ }
2893
2751
  return _omit(arg0, arg1)
2894
2752
  }
2895
2753
 
2896
2754
  const thunkify = (func, ...args) => function thunk() {
2755
+ if (areAnyValuesPromises(args)) {
2756
+ return promiseAll(args).then(curry2(funcApply, func, __))
2757
+ }
2897
2758
  return func(...args)
2898
2759
  }
2899
2760
 
@@ -2904,25 +2765,43 @@ curry.arity = function curryArity_(arity, func, ...args) {
2904
2765
  }
2905
2766
 
2906
2767
  const rubico = {
2907
- pipe, tap,
2908
- switchCase, tryCatch,
2909
- fork, assign, get, set, pick, omit,
2910
- map, filter, reduce, transform, flatMap,
2911
- and, or, not, any, all,
2768
+ pipe, compose,
2769
+
2770
+ tap, forEach,
2771
+
2772
+ switchCase,
2773
+
2774
+ tryCatch,
2775
+
2776
+ all, assign, get, set, pick, omit,
2777
+
2778
+ map, filter, flatMap, reduce, transform,
2779
+
2780
+ and, or, not, some, every,
2781
+
2912
2782
  eq, gt, lt, gte, lte,
2913
- thunkify, always,
2914
- curry, __,
2783
+
2784
+ thunkify, always, curry, __,
2915
2785
  }
2916
2786
 
2917
2787
  export {
2918
- pipe, tap,
2919
- switchCase, tryCatch,
2920
- fork, assign, get, set, pick, omit,
2788
+ pipe, compose,
2789
+
2790
+ tap, forEach,
2791
+
2792
+ switchCase,
2793
+
2794
+ tryCatch,
2795
+
2796
+ all, assign, get, set, pick, omit,
2797
+
2921
2798
  map, filter, reduce, transform, flatMap,
2922
- and, or, not, any, all,
2799
+
2800
+ and, or, not, some, every,
2801
+
2923
2802
  eq, gt, lt, gte, lte,
2924
- thunkify, always,
2925
- curry, __,
2803
+
2804
+ thunkify, always, curry, __,
2926
2805
  }
2927
2806
 
2928
2807
  export default rubico