rubico 2.11.0 → 2.13.0

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 (369) hide show
  1. package/README.md +16 -20
  2. package/Transducer.js +87 -72
  3. package/__.js +3 -3
  4. package/_internal/functionArrayAllSeries.js +4 -3
  5. package/_internal/functionObjectAllSeries.js +65 -0
  6. package/_internal/genericTransform.js +0 -1
  7. package/all.js +36 -16
  8. package/always.js +4 -4
  9. package/and.js +34 -26
  10. package/assign.js +5 -5
  11. package/compose.js +7 -6
  12. package/curry.js +48 -28
  13. package/dist/Transducer.es.js +1 -1
  14. package/dist/Transducer.es.min.js +1 -1
  15. package/dist/Transducer.js +1 -1
  16. package/dist/Transducer.min.js +1 -1
  17. package/dist/Transducer.mjs +1 -1
  18. package/dist/__.es.js +1 -1
  19. package/dist/__.es.min.js +1 -1
  20. package/dist/__.js +1 -1
  21. package/dist/__.min.js +1 -1
  22. package/dist/__.mjs +1 -1
  23. package/dist/all.es.js +112 -8
  24. package/dist/all.es.min.js +2 -2
  25. package/dist/all.js +112 -8
  26. package/dist/all.min.js +2 -2
  27. package/dist/all.mjs +112 -8
  28. package/dist/always.es.js +1 -1
  29. package/dist/always.es.min.js +1 -1
  30. package/dist/always.js +1 -1
  31. package/dist/always.min.js +1 -1
  32. package/dist/always.mjs +1 -1
  33. package/dist/and.es.js +1 -1
  34. package/dist/and.es.min.js +1 -1
  35. package/dist/and.js +1 -1
  36. package/dist/and.min.js +1 -1
  37. package/dist/and.mjs +1 -1
  38. package/dist/assign.es.js +1 -1
  39. package/dist/assign.es.min.js +1 -1
  40. package/dist/assign.js +1 -1
  41. package/dist/assign.min.js +1 -1
  42. package/dist/assign.mjs +1 -1
  43. package/dist/compose.es.js +1 -1
  44. package/dist/compose.es.min.js +1 -1
  45. package/dist/compose.js +1 -1
  46. package/dist/compose.min.js +1 -1
  47. package/dist/compose.mjs +1 -1
  48. package/dist/curry.es.js +1 -1
  49. package/dist/curry.es.min.js +1 -1
  50. package/dist/curry.js +1 -1
  51. package/dist/curry.min.js +1 -1
  52. package/dist/curry.mjs +1 -1
  53. package/dist/eq.es.js +1 -1
  54. package/dist/eq.es.min.js +1 -1
  55. package/dist/eq.js +1 -1
  56. package/dist/eq.min.js +1 -1
  57. package/dist/eq.mjs +1 -1
  58. package/dist/every.es.js +1 -1
  59. package/dist/every.es.min.js +1 -1
  60. package/dist/every.js +1 -1
  61. package/dist/every.min.js +1 -1
  62. package/dist/every.mjs +1 -1
  63. package/dist/filter.es.js +113 -19
  64. package/dist/filter.es.min.js +2 -2
  65. package/dist/filter.js +113 -19
  66. package/dist/filter.min.js +2 -2
  67. package/dist/filter.mjs +113 -19
  68. package/dist/flatMap.es.js +1 -1
  69. package/dist/flatMap.es.min.js +1 -1
  70. package/dist/flatMap.js +1 -1
  71. package/dist/flatMap.min.js +1 -1
  72. package/dist/flatMap.mjs +1 -1
  73. package/dist/forEach.es.js +1 -1
  74. package/dist/forEach.es.min.js +1 -1
  75. package/dist/forEach.js +1 -1
  76. package/dist/forEach.min.js +1 -1
  77. package/dist/forEach.mjs +1 -1
  78. package/dist/get.es.js +1 -1
  79. package/dist/get.es.min.js +1 -1
  80. package/dist/get.js +1 -1
  81. package/dist/get.min.js +1 -1
  82. package/dist/get.mjs +1 -1
  83. package/dist/gt.es.js +1 -1
  84. package/dist/gt.es.min.js +1 -1
  85. package/dist/gt.js +1 -1
  86. package/dist/gt.min.js +1 -1
  87. package/dist/gt.mjs +1 -1
  88. package/dist/gte.es.js +1 -1
  89. package/dist/gte.es.min.js +1 -1
  90. package/dist/gte.js +1 -1
  91. package/dist/gte.min.js +1 -1
  92. package/dist/gte.mjs +1 -1
  93. package/dist/lt.es.js +1 -1
  94. package/dist/lt.es.min.js +1 -1
  95. package/dist/lt.js +1 -1
  96. package/dist/lt.min.js +1 -1
  97. package/dist/lt.mjs +1 -1
  98. package/dist/lte.es.js +1 -1
  99. package/dist/lte.es.min.js +1 -1
  100. package/dist/lte.js +1 -1
  101. package/dist/lte.min.js +1 -1
  102. package/dist/lte.mjs +1 -1
  103. package/dist/map.es.js +1 -1
  104. package/dist/map.es.min.js +1 -1
  105. package/dist/map.js +1 -1
  106. package/dist/map.min.js +1 -1
  107. package/dist/map.mjs +1 -1
  108. package/dist/not.es.js +1 -1
  109. package/dist/not.es.min.js +1 -1
  110. package/dist/not.js +1 -1
  111. package/dist/not.min.js +1 -1
  112. package/dist/not.mjs +1 -1
  113. package/dist/omit.es.js +1 -1
  114. package/dist/omit.es.min.js +1 -1
  115. package/dist/omit.js +1 -1
  116. package/dist/omit.min.js +1 -1
  117. package/dist/omit.mjs +1 -1
  118. package/dist/or.es.js +1 -1
  119. package/dist/or.es.min.js +1 -1
  120. package/dist/or.js +1 -1
  121. package/dist/or.min.js +1 -1
  122. package/dist/or.mjs +1 -1
  123. package/dist/pick.es.js +1 -1
  124. package/dist/pick.es.min.js +1 -1
  125. package/dist/pick.js +1 -1
  126. package/dist/pick.min.js +1 -1
  127. package/dist/pick.mjs +1 -1
  128. package/dist/pipe.es.js +1 -1
  129. package/dist/pipe.es.min.js +1 -1
  130. package/dist/pipe.js +1 -1
  131. package/dist/pipe.min.js +1 -1
  132. package/dist/pipe.mjs +1 -1
  133. package/dist/reduce.es.js +1 -1
  134. package/dist/reduce.es.min.js +1 -1
  135. package/dist/reduce.js +1 -1
  136. package/dist/reduce.min.js +1 -1
  137. package/dist/reduce.mjs +1 -1
  138. package/dist/rubico.es.js +168 -79
  139. package/dist/rubico.es.min.js +2 -2
  140. package/dist/rubico.global.js +168 -79
  141. package/dist/rubico.global.min.js +2 -2
  142. package/dist/rubico.js +168 -79
  143. package/dist/rubico.min.js +2 -2
  144. package/dist/rubico.mjs +168 -79
  145. package/dist/set.es.js +1 -1
  146. package/dist/set.es.min.js +1 -1
  147. package/dist/set.js +1 -1
  148. package/dist/set.min.js +1 -1
  149. package/dist/set.mjs +1 -1
  150. package/dist/some.es.js +1 -1
  151. package/dist/some.es.min.js +1 -1
  152. package/dist/some.js +1 -1
  153. package/dist/some.min.js +1 -1
  154. package/dist/some.mjs +1 -1
  155. package/dist/switchCase.es.js +1 -1
  156. package/dist/switchCase.es.min.js +1 -1
  157. package/dist/switchCase.js +1 -1
  158. package/dist/switchCase.min.js +1 -1
  159. package/dist/switchCase.mjs +1 -1
  160. package/dist/tap.es.js +1 -1
  161. package/dist/tap.es.min.js +1 -1
  162. package/dist/tap.js +1 -1
  163. package/dist/tap.min.js +1 -1
  164. package/dist/tap.mjs +1 -1
  165. package/dist/thunkify.es.js +1 -1
  166. package/dist/thunkify.es.min.js +1 -1
  167. package/dist/thunkify.js +1 -1
  168. package/dist/thunkify.min.js +1 -1
  169. package/dist/thunkify.mjs +1 -1
  170. package/dist/transform.es.js +1 -3
  171. package/dist/transform.es.min.js +2 -2
  172. package/dist/transform.js +1 -3
  173. package/dist/transform.min.js +1 -1
  174. package/dist/transform.mjs +1 -3
  175. package/dist/tryCatch.es.js +1 -1
  176. package/dist/tryCatch.es.min.js +1 -1
  177. package/dist/tryCatch.js +1 -1
  178. package/dist/tryCatch.min.js +1 -1
  179. package/dist/tryCatch.mjs +1 -1
  180. package/dist/x/append.es.js +1 -1
  181. package/dist/x/append.es.min.js +1 -1
  182. package/dist/x/append.js +1 -1
  183. package/dist/x/append.min.js +1 -1
  184. package/dist/x/append.mjs +1 -1
  185. package/dist/x/callProp.es.js +1 -1
  186. package/dist/x/callProp.es.min.js +1 -1
  187. package/dist/x/callProp.js +1 -1
  188. package/dist/x/callProp.min.js +1 -1
  189. package/dist/x/callProp.mjs +1 -1
  190. package/dist/x/defaultsDeep.es.js +1 -1
  191. package/dist/x/defaultsDeep.es.min.js +1 -1
  192. package/dist/x/defaultsDeep.js +1 -1
  193. package/dist/x/defaultsDeep.min.js +1 -1
  194. package/dist/x/defaultsDeep.mjs +1 -1
  195. package/dist/x/differenceWith.es.js +1 -1
  196. package/dist/x/differenceWith.es.min.js +1 -1
  197. package/dist/x/differenceWith.js +1 -1
  198. package/dist/x/differenceWith.min.js +1 -1
  199. package/dist/x/differenceWith.mjs +1 -1
  200. package/dist/x/filterOut.es.js +113 -19
  201. package/dist/x/filterOut.es.min.js +2 -2
  202. package/dist/x/filterOut.js +113 -19
  203. package/dist/x/filterOut.min.js +2 -2
  204. package/dist/x/filterOut.mjs +113 -19
  205. package/dist/x/find.es.js +1 -1
  206. package/dist/x/find.es.min.js +1 -1
  207. package/dist/x/find.js +1 -1
  208. package/dist/x/find.min.js +1 -1
  209. package/dist/x/find.mjs +1 -1
  210. package/dist/x/findIndex.es.js +1 -1
  211. package/dist/x/findIndex.es.min.js +1 -1
  212. package/dist/x/findIndex.js +1 -1
  213. package/dist/x/findIndex.min.js +1 -1
  214. package/dist/x/findIndex.mjs +1 -1
  215. package/dist/x/first.es.js +1 -1
  216. package/dist/x/first.es.min.js +1 -1
  217. package/dist/x/first.js +1 -1
  218. package/dist/x/first.min.js +1 -1
  219. package/dist/x/first.mjs +1 -1
  220. package/dist/x/flatten.es.js +1 -1
  221. package/dist/x/flatten.es.min.js +1 -1
  222. package/dist/x/flatten.js +1 -1
  223. package/dist/x/flatten.min.js +1 -1
  224. package/dist/x/flatten.mjs +1 -1
  225. package/dist/x/groupBy.es.js +1 -1
  226. package/dist/x/groupBy.es.min.js +1 -1
  227. package/dist/x/groupBy.js +1 -1
  228. package/dist/x/groupBy.min.js +1 -1
  229. package/dist/x/groupBy.mjs +1 -1
  230. package/dist/x/has.es.js +1 -1
  231. package/dist/x/has.es.min.js +1 -1
  232. package/dist/x/has.js +1 -1
  233. package/dist/x/has.min.js +1 -1
  234. package/dist/x/has.mjs +1 -1
  235. package/dist/x/identity.es.js +1 -1
  236. package/dist/x/identity.es.min.js +1 -1
  237. package/dist/x/identity.js +1 -1
  238. package/dist/x/identity.min.js +1 -1
  239. package/dist/x/identity.mjs +1 -1
  240. package/dist/x/includes.es.js +1 -1
  241. package/dist/x/includes.es.min.js +1 -1
  242. package/dist/x/includes.js +1 -1
  243. package/dist/x/includes.min.js +1 -1
  244. package/dist/x/includes.mjs +1 -1
  245. package/dist/x/isDeepEqual.es.js +1 -1
  246. package/dist/x/isDeepEqual.es.min.js +1 -1
  247. package/dist/x/isDeepEqual.js +1 -1
  248. package/dist/x/isDeepEqual.min.js +1 -1
  249. package/dist/x/isDeepEqual.mjs +1 -1
  250. package/dist/x/isEmpty.es.js +1 -1
  251. package/dist/x/isEmpty.es.min.js +1 -1
  252. package/dist/x/isEmpty.js +1 -1
  253. package/dist/x/isEmpty.min.js +1 -1
  254. package/dist/x/isEmpty.mjs +1 -1
  255. package/dist/x/isEqual.es.js +1 -1
  256. package/dist/x/isEqual.es.min.js +1 -1
  257. package/dist/x/isEqual.js +1 -1
  258. package/dist/x/isEqual.min.js +1 -1
  259. package/dist/x/isEqual.mjs +1 -1
  260. package/dist/x/isFunction.es.js +1 -1
  261. package/dist/x/isFunction.es.min.js +1 -1
  262. package/dist/x/isFunction.js +1 -1
  263. package/dist/x/isFunction.min.js +1 -1
  264. package/dist/x/isFunction.mjs +1 -1
  265. package/dist/x/isIn.es.js +1 -1
  266. package/dist/x/isIn.es.min.js +1 -1
  267. package/dist/x/isIn.js +1 -1
  268. package/dist/x/isIn.min.js +1 -1
  269. package/dist/x/isIn.mjs +1 -1
  270. package/dist/x/isObject.es.js +1 -1
  271. package/dist/x/isObject.es.min.js +1 -1
  272. package/dist/x/isObject.js +1 -1
  273. package/dist/x/isObject.min.js +1 -1
  274. package/dist/x/isObject.mjs +1 -1
  275. package/dist/x/isString.es.js +1 -1
  276. package/dist/x/isString.es.min.js +1 -1
  277. package/dist/x/isString.js +1 -1
  278. package/dist/x/isString.min.js +1 -1
  279. package/dist/x/isString.mjs +1 -1
  280. package/dist/x/keys.es.js +1 -1
  281. package/dist/x/keys.es.min.js +1 -1
  282. package/dist/x/keys.js +1 -1
  283. package/dist/x/keys.min.js +1 -1
  284. package/dist/x/keys.mjs +1 -1
  285. package/dist/x/last.es.js +1 -1
  286. package/dist/x/last.es.min.js +1 -1
  287. package/dist/x/last.js +1 -1
  288. package/dist/x/last.min.js +1 -1
  289. package/dist/x/last.mjs +1 -1
  290. package/dist/x/maxBy.es.js +1 -1
  291. package/dist/x/maxBy.es.min.js +1 -1
  292. package/dist/x/maxBy.js +1 -1
  293. package/dist/x/maxBy.min.js +1 -1
  294. package/dist/x/maxBy.mjs +1 -1
  295. package/dist/x/noop.es.js +1 -1
  296. package/dist/x/noop.es.min.js +1 -1
  297. package/dist/x/noop.js +1 -1
  298. package/dist/x/noop.min.js +1 -1
  299. package/dist/x/noop.mjs +1 -1
  300. package/dist/x/pluck.es.js +1 -1
  301. package/dist/x/pluck.es.min.js +1 -1
  302. package/dist/x/pluck.js +1 -1
  303. package/dist/x/pluck.min.js +1 -1
  304. package/dist/x/pluck.mjs +1 -1
  305. package/dist/x/prepend.es.js +1 -1
  306. package/dist/x/prepend.es.min.js +1 -1
  307. package/dist/x/prepend.js +1 -1
  308. package/dist/x/prepend.min.js +1 -1
  309. package/dist/x/prepend.mjs +1 -1
  310. package/dist/x/size.es.js +1 -1
  311. package/dist/x/size.es.min.js +1 -1
  312. package/dist/x/size.js +1 -1
  313. package/dist/x/size.min.js +1 -1
  314. package/dist/x/size.mjs +1 -1
  315. package/dist/x/trace.es.js +1 -1
  316. package/dist/x/trace.es.min.js +1 -1
  317. package/dist/x/trace.js +1 -1
  318. package/dist/x/trace.min.js +1 -1
  319. package/dist/x/trace.mjs +1 -1
  320. package/dist/x/unionWith.es.js +1 -1
  321. package/dist/x/unionWith.es.min.js +1 -1
  322. package/dist/x/unionWith.js +1 -1
  323. package/dist/x/unionWith.min.js +1 -1
  324. package/dist/x/unionWith.mjs +1 -1
  325. package/dist/x/uniq.es.js +1 -1
  326. package/dist/x/uniq.es.min.js +1 -1
  327. package/dist/x/uniq.js +1 -1
  328. package/dist/x/uniq.min.js +1 -1
  329. package/dist/x/uniq.mjs +1 -1
  330. package/dist/x/unless.es.js +1 -1
  331. package/dist/x/unless.es.min.js +1 -1
  332. package/dist/x/unless.js +1 -1
  333. package/dist/x/unless.min.js +1 -1
  334. package/dist/x/unless.mjs +1 -1
  335. package/dist/x/values.es.js +1 -1
  336. package/dist/x/values.es.min.js +1 -1
  337. package/dist/x/values.js +1 -1
  338. package/dist/x/values.min.js +1 -1
  339. package/dist/x/values.mjs +1 -1
  340. package/dist/x/when.es.js +1 -1
  341. package/dist/x/when.es.min.js +1 -1
  342. package/dist/x/when.js +1 -1
  343. package/dist/x/when.min.js +1 -1
  344. package/dist/x/when.mjs +1 -1
  345. package/eq.js +29 -30
  346. package/es.js +168 -79
  347. package/every.js +16 -22
  348. package/filter.js +41 -78
  349. package/flatMap.js +16 -16
  350. package/forEach.js +14 -14
  351. package/get.js +3 -3
  352. package/gt.js +18 -25
  353. package/gte.js +22 -29
  354. package/index.js +168 -79
  355. package/lt.js +33 -31
  356. package/lte.js +24 -31
  357. package/map.js +43 -46
  358. package/not.js +12 -17
  359. package/or.js +34 -26
  360. package/package.json +1 -1
  361. package/pipe.js +6 -6
  362. package/reduce.js +62 -69
  363. package/some.js +13 -36
  364. package/switchCase.js +9 -9
  365. package/tap.js +7 -12
  366. package/thunkify.js +42 -12
  367. package/transform.js +62 -61
  368. package/tryCatch.js +4 -7
  369. package/_internal/add.js +0 -12
package/reduce.js CHANGED
@@ -23,24 +23,44 @@ const _reduce = function (collection, reducer, initial) {
23
23
  * ```coffeescript [specscript]
24
24
  * type Foldable = Array|Set|Map|Generator|AsyncGenerator|{ reduce: function }|Object
25
25
  *
26
- * type SyncOrAsyncReducer = (
26
+ * type Reducer = (
27
27
  * accumulator any,
28
- * element any,
28
+ * item any,
29
29
  * indexOrKey number|string|any,
30
30
  * foldable Foldable
31
31
  * )=>(nextAccumulator Promise|any)
32
32
  *
33
- * type UnarySyncOrAsyncResolver = any=>Promise|any
33
+ * type Resolver = any=>Promise|any
34
34
  *
35
- * reducer SyncOrAsyncReducer
36
- * initial UnarySyncOrAsyncResolver|any
35
+ * reduce(foldable Promise|Foldable, reducer Reducer) -> accumulator Promise|any
36
+ * reduce(foldable Promise|Foldable, reducer Reducer, initialValue Promise|any) -> accumulator Promise|any
37
+ * reduce(foldable Promise|Foldable, reducer Reducer, initialResolver Resolver) -> accumulator Promise|any
37
38
  *
38
- * reduce(foldable Promise|Foldable, reducer, initial?) -> result Promise|any
39
- * reduce(reducer, initial?)(foldable Foldable) -> result Promise|any
39
+ * reduce(reducer Reducer)(foldable Foldable) -> accumulator Promise|any
40
+ * reduce(reducer Reducer, initialValue Promise|any)(foldable Foldable) -> accumulator Promise|any
41
+ * reduce(reducer Reducer, initialResolver Resolver)(foldable Foldable) -> accumulator Promise|any
40
42
  * ```
41
43
  *
42
44
  * @description
43
- * Reduces a foldable to a single value.
45
+ * Reduces a foldable to an accumulated value.
46
+ *
47
+ * ```javascript [playground]
48
+ * const max = (a, b) => a > b ? a : b
49
+ *
50
+ * const result = reduce([1, 3, 5, 4, 2], max)
51
+ *
52
+ * console.log(result)
53
+ * ```
54
+ *
55
+ * `reduce` executes a reducer function for each item of a foldable in order. If an initial value is provided, `reduce` starts iterating from the first item of the foldable. If no initial value is provided, `reduce` uses the first item of the foldable as the initial value and starts iterating from the second item of the foldable.
56
+ *
57
+ * ```javascript [playground]
58
+ * const add = (a, b) => a + b
59
+ *
60
+ * const result = reduce([1, 2, 3, 4, 5], add, 10)
61
+ *
62
+ * console.log(result)
63
+ * ```
44
64
  *
45
65
  * The following data types are considered to be foldables:
46
66
  * * `array`
@@ -51,11 +71,11 @@ const _reduce = function (collection, reducer, initial) {
51
71
  * * `object with .reduce method`
52
72
  * * `object`
53
73
  *
54
- * The reducing operation is dictated by a provided reducer function, which defines a transformation between the accumulator and a given element of the foldable.
74
+ * The reducing operation is expressed by the reducer function and optional initial value, which defines a transformation between an accumulator and a given item of the foldable.
55
75
  *
56
76
  * ```javascript
57
- * const reducer = function (accumulator, element) {
58
- * // nextAccumulator is the result of some operation between accumulator and element
77
+ * const reducer = function (accumulator, item) {
78
+ * // nextAccumulator is the result of some operation between accumulator and item
59
79
  * // and becomes the accumulator for the next iteration and invocation of the reducer
60
80
  * return nextAccumulator
61
81
  * }
@@ -67,7 +87,7 @@ const _reduce = function (collection, reducer, initial) {
67
87
  * ```coffeescript [specscript]
68
88
  * reducer(
69
89
  * accumulator any,
70
- * element any,
90
+ * item any,
71
91
  * index number,
72
92
  * fold Array
73
93
  * ) -> nextAccumulator Promise|any
@@ -77,7 +97,7 @@ const _reduce = function (collection, reducer, initial) {
77
97
  * ```coffeescript [specscript]
78
98
  * reducer(
79
99
  * accumulator any,
80
- * element any
100
+ * item any
81
101
  * ) -> nextAccumulator Promise|any
82
102
  * ```
83
103
  *
@@ -85,7 +105,7 @@ const _reduce = function (collection, reducer, initial) {
85
105
  * ```coffeescript [specscript]
86
106
  * reducer(
87
107
  * accumulator any,
88
- * element any,
108
+ * item any,
89
109
  * key any,
90
110
  * fold Map
91
111
  * ) -> nextAccumulator Promise|any
@@ -95,7 +115,7 @@ const _reduce = function (collection, reducer, initial) {
95
115
  * ```coffeescript [specscript]
96
116
  * reducer(
97
117
  * accumulator any,
98
- * element any
118
+ * item any
99
119
  * ) -> nextAccumulator Promise|any
100
120
  * ```
101
121
  *
@@ -103,47 +123,30 @@ const _reduce = function (collection, reducer, initial) {
103
123
  * ```coffeescript [specscript]
104
124
  * reducer(
105
125
  * accumulator any,
106
- * element any
126
+ * item any
107
127
  * ) -> nextAccumulator Promise|any
108
128
  * ```
109
129
  *
110
- * If the foldable is an object with a `.reduce` method, the reducer function signature is defined externally.
111
- *
112
130
  * If the foldable is a plain object:
113
131
  * ```coffeescript [specscript]
114
132
  * reducer(
115
133
  * accumulator any,
116
- * element any,
134
+ * item any,
117
135
  * key string,
118
136
  * fold Object
119
137
  * ) -> nextAccumulator Promise|any
120
138
  * ```
121
139
  *
122
- * `reduce` executes a reducer function for each element of the array in order. If no initial value is provided, `reduce` uses the first element of the foldable as the initial value and starts iterating from the second element of the foldable.
123
- *
124
- * ```javascript [playground]
125
- * const max = (a, b) => a > b ? a : b
126
- *
127
- * const result = reduce([1, 3, 5, 4, 2], max)
128
- * console.log(result) // 5
129
- * ```
130
- *
131
- * If an initial value is provided, the accumulator starts as the initial value rather than the first element of the foldable.
132
- *
133
- * ```javascript [playground]
134
- * const add = (a, b) => a + b
135
- *
136
- * const result = reduce([1, 2, 3, 4, 5], add, 0)
137
- * console.log(result) // 15
138
- * ```
140
+ * If the foldable is an object with a `.reduce` method, the reducer function signature is defined externally.
139
141
  *
140
142
  * If the reducer is asynchronous, all promises created by the reducer are resolved before continuing with the reducing operation.
141
143
  *
142
144
  * ```javascript [playground]
143
145
  * const asyncAdd = async (a, b) => a + b
144
146
  *
145
- * const promise = reduce([1, 2, 3, 4, 5], asyncAdd, 0)
146
- * promise.then(console.log) // 15
147
+ * const result = await reduce([1, 2, 3, 4, 5], asyncAdd, 0)
148
+ *
149
+ * console.log(result)
147
150
  * ```
148
151
  *
149
152
  * If the initialization parameter is a function, it is treated as a resolver of the initial value and called with the foldable.
@@ -151,63 +154,53 @@ const _reduce = function (collection, reducer, initial) {
151
154
  * ```javascript [playground]
152
155
  * const concatSquares = (array, value) => array.concat(value ** 2)
153
156
  *
154
- * const contrivedInitializer = array => [`initial length ${array.length}`]
155
- *
156
157
  * const array = [1, 2, 3, 4, 5]
157
158
  *
158
- * console.log(reduce(array, concatSquares, contrivedInitializer))
159
- * // ['initial length 5', 1, 4, 9, 16, 25]
160
- * ```
161
- *
162
- * For objects, `reduce` iterates over just the values.
163
- *
164
- * ```javascript [playground]
165
- * const add = (a, b) => a + b
166
- *
167
- * const obj = { a: 1, b: 2, c: 3, d: 4, e: 5 }
159
+ * const result = reduce(array, concatSquares, () => [])
168
160
  *
169
- * const result = reduce(obj, add)
170
- * console.log(result) // 15
161
+ * console.log(result)
171
162
  * ```
172
163
  *
173
- * For maps, `reduce` iterates over the values of the entries.
164
+ * `reduce` iterates over just the values of objects and maps.
174
165
  *
175
166
  * ```javascript [playground]
176
167
  * const add = (a, b) => a + b
177
168
  *
178
- * const m = new Map([['a', 1], ['b', 2], ['c', 3], ['d', 4], ['e', 5]])
169
+ * const object = { a: 1, b: 2, c: 3, d: 4, e: 5 }
170
+ * const map = new Map([['a', 1], ['b', 2], ['c', 3], ['d', 4], ['e', 5]])
179
171
  *
180
- * const result = reduce(m, add)
181
- * console.log(result) // 15
172
+ * const objectResult = reduce(object, add)
173
+ * const mapResult = reduce(map, add)
174
+ *
175
+ * console.log(objectResult)
176
+ * console.log(mapResult)
182
177
  * ```
183
178
  *
184
- * `reduce` works for async generators.
179
+ * `reduce` reduces async generators.
185
180
  *
186
181
  * ```javascript [playground]
187
- * const asyncAdd = async (a, b) => a + b
182
+ * const add = (a, b) => a + b
188
183
  *
189
- * const asyncGenerate = async function* () {
184
+ * const generateAsyncNumbers = async function* () {
190
185
  * yield 1; yield 2; yield 3; yield 4; yield 5
191
186
  * }
192
187
  *
193
- * reduce(asyncGenerate(), asyncAdd).then(console.log) // 15
188
+ * const result = await reduce(generateAsyncNumbers(), add)
189
+ *
190
+ * console.log(result)
194
191
  * ```
195
192
  *
196
- * Any promises passed in data argument position are resolved for their values before further execution.
193
+ * If the foldable or initial value is a promise, it is resolved for its value before further execution for the eager interface only.
197
194
  *
198
195
  * ```javascript [playground]
199
196
  * const add = (a, b) => a + b
200
197
  *
201
- * reduce(Promise.resolve([1, 2, 3, 4, 5]), add, 0).then(console.log) // 15
202
- * ```
203
- *
204
- * Any promises passed for the initial value are also resolved before further execution.
198
+ * const resultWithPromiseFoldable = await reduce(Promise.resolve([1, 2, 3, 4, 5]), add, 0)
205
199
  *
206
- * ```javascript [playground]
207
- * const add = (a, b) => a + b
200
+ * const resultWithPromiseInitialValue = await reduce([1, 2, 3, 4, 5], add, Promise.resolve(0))
208
201
  *
209
- * const promise = reduce([1, 2, 3, 4, 5], add, Promise.resolve(0))
210
- * promise.then(console.log) // 15
202
+ * console.log(resultWithPromiseFoldable)
203
+ * console.log(resultWithPromiseInitialValue)
211
204
  * ```
212
205
  *
213
206
  * See also:
package/some.js CHANGED
@@ -41,23 +41,25 @@ const _some = function (collection, predicate) {
41
41
  * @synopsis
42
42
  * ```coffeescript [specscript]
43
43
  * type Foldable = Array|Set|Map|Generator|AsyncGenerator|{ reduce: function }|Object
44
- * type UnarySyncOrAsyncPredicate = any=>Promise|boolean
44
+ * type Predicate = any=>Promise|boolean
45
45
  *
46
- * predicate UnarySyncOrAsyncPredicate
46
+ * predicate Predicate
47
47
  *
48
- * some(foldable Foldable, predicate) -> Promise|boolean
49
- * some(predicate)(foldable Foldable) -> Promise|boolean
48
+ * some(foldable Promise|Foldable, predicate) -> testResult Promise|boolean
49
+ * some(predicate)(foldable Foldable) -> testResult Promise|boolean
50
50
  * ```
51
51
  *
52
52
  * @description
53
- * Test a predicate concurrently across all elements of a foldable, returning true if any executions return true.
53
+ * Tests a predicate concurrently across all items of a foldable. Returns true if any item tests true by the predicate.
54
54
  *
55
55
  * ```javascript [playground]
56
56
  * const isOdd = number => number % 2 == 1
57
57
  *
58
- * console.log(
59
- * some([1, 2, 3, 4, 5], isOdd),
60
- * ) // true
58
+ * const array = [1, 2, 3, 4, 5]
59
+ *
60
+ * const arrayHasOddNumbers = some(array, isOdd)
61
+ *
62
+ * console.log(arrayHasOddNumbers)
61
63
  * ```
62
64
  *
63
65
  * The following data types are considered to be foldables:
@@ -69,44 +71,19 @@ const _some = function (collection, predicate) {
69
71
  * * `object with .reduce method`
70
72
  * * `object`
71
73
  *
72
- * `some` works for async generators.
73
- *
74
- * ```javascript [playground]
75
- * const toTodosUrl = id => 'https://jsonplaceholder.typicode.com/todos/' + id
76
- *
77
- * const fetchedToJson = fetched => fetched.json()
78
- *
79
- * const fetchTodo = pipe([
80
- * toTodosUrl,
81
- * fetch,
82
- * fetchedToJson,
83
- * ])
84
- *
85
- * const todoIDsGenerator = async function* () {
86
- * yield 1; yield 2; yield 3; yield 4; yield 5
87
- * }
88
- *
89
- * const promise = some(todoIDsGenerator(), async id => {
90
- * const todo = await fetchTodo(id)
91
- * return todo.title.startsWith('fugiat')
92
- * })
93
- *
94
- * promise.then(console.log) // true
95
- * ```
96
- *
97
74
  * `some` supports a lazy interface for composability.
98
75
  *
99
76
  * ```javascript [playground]
100
77
  * pipe([1, 2, 3], [
101
78
  * some(number => number < 5),
102
- * console.log, // true
79
+ * console.log,
103
80
  * ])
104
81
  * ```
105
82
  *
106
- * Any promises passed in data argument position are resolved for their values before further execution.
83
+ * If the foldable is a promise, it is resolved for its value before further execution for the eager interface only.
107
84
  *
108
85
  * ```javascript [playground]
109
- * some(Promise.resolve([1, 2, 3, 4, 5]), n => n > 6).then(console.log) // false
86
+ * some(Promise.resolve([1, 2, 3, 4, 5]), n => n > 6).then(console.log)
110
87
  * ```
111
88
  *
112
89
  * See also:
package/switchCase.js CHANGED
@@ -12,15 +12,15 @@ const curryArgs3 = require('./_internal/curryArgs3')
12
12
  *
13
13
  * @synopsis
14
14
  * ```coffeescript [specscript]
15
- * type SyncOrAsyncPredicate = (...arguments)=>Promise|boolean|any
16
- * type SyncOrAsyncFunction = (...arguments)=>Promise|any
15
+ * type Predicate = (...arguments)=>Promise|boolean|any
16
+ * type Function = (...arguments)=>Promise|any
17
17
  *
18
18
  * conditionalValues Array<Promise|boolean|any>
19
- * conditionalFunctionsOrValues Array<SyncOrAsyncPredicate|SyncOrAsyncFunction|Promise|boolean|any>
19
+ * conditionalFunctionsOrValues Array<Predicate|Function|Promise|boolean|any>
20
20
  *
21
- * switchCase(conditionalValues) -> Promise|any
22
- * switchCase(...arguments, conditionalFunctionsOrValues) -> Promise|any
23
- * switchCase(conditionalFunctionsOrValues)(...arguments) -> Promise|any
21
+ * switchCase(conditionalValues) -> result Promise|any
22
+ * switchCase(...arguments, conditionalFunctionsOrValues) -> result Promise|any
23
+ * switchCase(conditionalFunctionsOrValues)(...arguments) -> result Promise|any
24
24
  * ```
25
25
  *
26
26
  * @description
@@ -44,7 +44,7 @@ const curryArgs3 = require('./_internal/curryArgs3')
44
44
  * const fruitsGuesser = switchCase([
45
45
  * fruit => fruit.color == 'yellow',
46
46
  * fruit => fruit.name + ' is possibly a banana',
47
- * fruit => fruit.name + ' is probably not a banana',
47
+ * fruit => fruit.name + ' is possibly not a banana',
48
48
  * ])
49
49
  *
50
50
  * const guess1 = fruitsGuesser({ name: 'plantain', color: 'yellow' })
@@ -91,13 +91,13 @@ const curryArgs3 = require('./_internal/curryArgs3')
91
91
  * (a, b, c) => console.log(`${a} + ${b} + ${c} !== 6`),
92
92
  * ])
93
93
  *
94
- * const promise = switchCase(true, [
94
+ * const result = await switchCase(true, [
95
95
  * bool => bool,
96
96
  * Promise.resolve(1),
97
97
  * Promise.resolve(2),
98
98
  * ])
99
99
  *
100
- * promise.then(console.log)
100
+ * console.log(result)
101
101
  * ```
102
102
  *
103
103
  * See also:
package/tap.js CHANGED
@@ -22,12 +22,10 @@ const _tap = function (args, f) {
22
22
  *
23
23
  * @synopsis
24
24
  * ```coffeescript [specscript]
25
- * type SyncOrAsyncFunction = (...arguments)=>Promise|any
25
+ * type Function = (...arguments)=>Promise|any
26
26
  *
27
- * f SyncOrAsyncFunction
28
- *
29
- * tap(...arguments, f) -> Promise|arguments[0]
30
- * tap(f)(...arguments) -> Promise|arguments[0]
27
+ * tap(...arguments, f Function) -> result Promise|any
28
+ * tap(f Function)(...arguments) -> result Promise|any
31
29
  * ```
32
30
  *
33
31
  * @description
@@ -103,14 +101,11 @@ const _tapIf = function (predicate, f, args) {
103
101
  *
104
102
  * @synopsis
105
103
  * ```coffeescript [specscript]
106
- * type SyncOrAsyncPredicate = (...arguments)=>Promise|boolean|any
107
- * type SyncOrAsyncFunction = (...arguments)=>Promise|any
108
- *
109
- * predicate SyncOrAsyncPredicate
110
- * f SyncOrAsyncFunction
104
+ * type Predicate = (...arguments)=>Promise|boolean|any
105
+ * type Function = (...arguments)=>Promise|any
111
106
  *
112
- * tap.if(...arguments, predicate, f) -> Promise|arguments[0]
113
- * tap.if(predicate, f)(...arguments) -> Promise|arguments[0]
107
+ * tap.if(...arguments, predicate Predicate, f Function) -> result Promise|any
108
+ * tap.if(predicate Predicate, f Function)(...arguments) -> result Promise|any
114
109
  * ```
115
110
  *
116
111
  * @description
package/thunkify.js CHANGED
@@ -23,20 +23,28 @@ function _thunkifyArgs(func, context, args) {
23
23
  *
24
24
  * @synopsis
25
25
  * ```coffeescript [specscript]
26
- * args Array<any>
27
- *
28
- * thunkify(func function, ...args) -> thunk ()=>func(...args)
26
+ * thunkify(func function, ...arguments) -> thunk function
29
27
  * ```
30
28
  *
31
29
  * @description
32
- * Creates a thunk from a function and arguments. A thunk takes no arguments, and when called, executes the other function with the arguments. The other function is said to be "thunkified".
30
+ * Creates a thunk function from a function and arguments. A thunk function takes no arguments, and when called, executes the function and arguments. The function is said to be "thunkified".
33
31
  *
34
32
  * ```javascript [playground]
35
33
  * const add = (a, b) => a + b
36
34
  *
37
35
  * const thunkAdd12 = thunkify(add, 1, 2)
38
36
  *
39
- * console.log(thunkAdd12()) // 3
37
+ * console.log(thunkAdd12())
38
+ * ```
39
+ *
40
+ * Any promises in `arguments` are resolved for their values during thunk creation.
41
+ *
42
+ * ```javascript [playground]
43
+ * const add = (a, b) => a + b
44
+ *
45
+ * const thunkAdd12 = await thunkify(add, Promise.resolve(1), 2)
46
+ *
47
+ * console.log(thunkAdd12())
40
48
  * ```
41
49
  *
42
50
  * See also:
@@ -60,13 +68,35 @@ const thunkify = function thunkify(func, ...args) {
60
68
  *
61
69
  * @synopsis
62
70
  * ```coffeescript [specscript]
63
- * args Array<any>
64
- *
65
- * thunkify.call(func function, context object, ...args) -> thunk ()=>func(...args)
71
+ * thunkify.call(func function, context object, ...arguments) -> thunk function
66
72
  * ```
67
73
  *
68
74
  * @description
69
- * Creates a thunk that calls a function with the specified context and arguments.
75
+ * Creates a thunk function that calls a function with the specified context and arguments.
76
+ *
77
+ * ```javascript [playground]
78
+ * class Point {
79
+ * constructor(x, y) {
80
+ * this.x = x
81
+ * this.y = y
82
+ * }
83
+ *
84
+ * distanceTo(point) {
85
+ * const x2 = (point.x - this.x) ** 2
86
+ * const y2 = (point.y - this.y) ** 2
87
+ * return (x2 + y2) ** 0.5
88
+ * }
89
+ * }
90
+ *
91
+ * const point0 = new Point(0, 0)
92
+ * const point1 = new Point(3, 4)
93
+ *
94
+ * const thunk = thunkify.call(point0.distanceTo, point0, point1)
95
+ *
96
+ * console.log(thunk())
97
+ * ```
98
+ *
99
+ * Any promises in `arguments` are resolved for their values during thunk creation.
70
100
  *
71
101
  * ```javascript [playground]
72
102
  * class Point {
@@ -75,7 +105,7 @@ const thunkify = function thunkify(func, ...args) {
75
105
  * this.y = y
76
106
  * }
77
107
  *
78
- * distanceTo() {
108
+ * distanceTo(point) {
79
109
  * const x2 = (point.x - this.x) ** 2
80
110
  * const y2 = (point.y - this.y) ** 2
81
111
  * return (x2 + y2) ** 0.5
@@ -83,9 +113,9 @@ const thunkify = function thunkify(func, ...args) {
83
113
  * }
84
114
  *
85
115
  * const point0 = new Point(0, 0)
86
- * const point = new Point(3, 4)
116
+ * const point1 = new Point(3, 4)
87
117
  *
88
- * const thunk = thunkify.call(point0.distanceTo, point0, point)
118
+ * const thunk = await thunkify.call(point0.distanceTo, point0, Promise.resolve(point1))
89
119
  *
90
120
  * console.log(thunk())
91
121
  * ```
package/transform.js CHANGED
@@ -22,23 +22,55 @@ const _transform = function (collection, transducer, initialValue) {
22
22
  * @synopsis
23
23
  * ```coffeescript [specscript]
24
24
  * type Foldable = Array|Set|Map|Generator|AsyncGenerator|{ reduce: function }|Object
25
- * type SyncOrAsyncReducer = (accumulator any, value any)=>(nextAccumulator Promise|any)
26
- * type Transducer = SyncOrAsyncReducer=>SyncOrAsyncReducer
25
+ * type Reducer = (accumulator any, value any)=>(nextAccumulator Promise|any)
26
+ * type Transducer = Reducer=>Reducer
27
27
  *
28
- * type Semigroup =
29
- * Array|String|Set|TypedArray|{ concat: function }|{ write: function }|Object
28
+ * type Semigroup = Array|String|Set|TypedArray|{ concat: function }|{ write: function }|Object
30
29
  *
31
- * type UnarySyncOrAsyncSemigroupResolver = any=>Promise|Semigroup
30
+ * type SemigroupResolver = any=>Promise|Semigroup
32
31
  *
33
- * transducer Transducer
34
- * initial UnarySyncOrAsyncSemigroupResolver|Semigroup
32
+ * transform(foldable Promise|Foldable, transducer, initialValue Promise|any) -> result Promise|Semigroup
33
+ * transform(foldable Promise|Foldable, transducer, initialResolver SemigroupResolver) -> result Promise|Semigroup
35
34
  *
36
- * transform(foldable Promise|Foldable, transducer, initial?) -> result Promise|Semigroup
37
- * transform(transducer, initial?)(foldable Foldable) -> result Promise|Semigroup
35
+ * transform(transducer, initialValue Promise|any)(foldable Foldable) -> result Promise|Semigroup
36
+ * transform(transducer, initialResolver SemigroupResolver)(foldable Foldable) -> result Promise|Semigroup
38
37
  * ```
39
38
  *
40
39
  * @description
41
- * Transforms a foldable with [transducers](https://rubico.land/blog/transducers-crash-course-rubico-v2) into a semigroup.
40
+ * Transforms a foldable into a semigroup with a [transducer](https://rubico.land/blog/transducers-crash-course-rubico-v2).
41
+ *
42
+ * ```javascript [playground]
43
+ * const square = number => number ** 2
44
+ *
45
+ * const isOdd = number => number % 2 == 1
46
+ *
47
+ * const squaredOdds = compose([
48
+ * Transducer.filter(isOdd),
49
+ * Transducer.map(square),
50
+ * ])
51
+ *
52
+ * const array = [1, 2, 3, 4, 5]
53
+ *
54
+ * // transform arrays into arrays
55
+ * const squaredOddsArray = transform(array, squaredOdds, [])
56
+ * console.log('array into array')
57
+ * console.log(squaredOddsArray)
58
+ *
59
+ * // transform arrays into strings
60
+ * const squaredOddsString = transform(array, squaredOdds, '')
61
+ * console.log('array into string')
62
+ * console.log(squaredOddsString)
63
+ *
64
+ * // transform arrays into sets
65
+ * const squaredOddsSet = transform(array, squaredOdds, new Set())
66
+ * console.log('array into set')
67
+ * console.log(squaredOddsSet)
68
+ *
69
+ * // transform arrays into typed arrays
70
+ * const squaredOddsUint8Array = transform(array, squaredOdds, new Uint8Array())
71
+ * console.log('array into binary')
72
+ * console.log(squaredOddsUint8Array)
73
+ * ```
42
74
  *
43
75
  * The following data types are considered to be foldables:
44
76
  * * `array`
@@ -49,11 +81,11 @@ const _transform = function (collection, transducer, initialValue) {
49
81
  * * `object with .reduce method`
50
82
  * * `object`
51
83
  *
52
- * Transducers, due to their lazy nature, don't have knowledge of the foldable they are transforming. As such, the transducer signature for all foldables is the same:
84
+ * The transducer defines the transformation done by `transform`. In a transformation, each item of the foldable is processed by the transducer in series.
53
85
  *
54
86
  * ```coffeescript [specscript]
55
- * type SyncOrAsyncReducer = (accumulator any, value any)=>(nextAccumulator Promise|any)
56
- * type Transducer = SyncOrAsyncReducer=>SyncOrAsyncReducer
87
+ * type Reducer = (accumulator any, value any)=>(nextAccumulator Promise|any)
88
+ * type Transducer = Reducer=>Reducer
57
89
  * ```
58
90
  *
59
91
  * The following data types are considered to be semigroups:
@@ -106,40 +138,7 @@ const _transform = function (collection, transducer, initialValue) {
106
138
  * nextAccumulator = ({ ...accumulator, ...values })
107
139
  * ```
108
140
  *
109
- * `transform` transforms numbers from an array into another array.
110
- *
111
- * ```javascript [playground]
112
- * const square = number => number ** 2
113
- *
114
- * const isOdd = number => number % 2 == 1
115
- *
116
- * const squaredOdds = compose([
117
- * Transducer.filter(isOdd),
118
- * Transducer.map(square),
119
- * ])
120
- *
121
- * // transform arrays into arrays
122
- * console.log(
123
- * transform([1, 2, 3, 4, 5], squaredOdds, [])
124
- * ) // [1, 9, 25]
125
- *
126
- * // transform arrays into strings
127
- * console.log(
128
- * transform([1, 2, 3, 4, 5], squaredOdds, '')
129
- * ) // '1925'
130
- *
131
- * // transform arrays into sets
132
- * console.log(
133
- * transform([1, 2, 3, 4, 5], squaredOdds, new Set())
134
- * ) // Set (3) { 1, 9, 25 }
135
- *
136
- * // transform arrays into typed arrays
137
- * console.log(
138
- * transform([1, 2, 3, 4, 5], squaredOdds, new Uint8Array()),
139
- * ) // Uint8Array(3) [ 1, 9, 25 ]
140
- * ```
141
- *
142
- * `transform` transforms arrays into objects that implement `.concat`.
141
+ * Any object that implements concat may be used as the semigroup for `transform`.
143
142
  *
144
143
  * ```javascript [playground]
145
144
  * const square = number => number ** 2
@@ -152,14 +151,9 @@ const _transform = function (collection, transducer, initialValue) {
152
151
  * }
153
152
  *
154
153
  * transform([1, 2, 3, 4, 5], Transducer.map(square), Stdout)
155
- * // 1
156
- * // 4
157
- * // 9
158
- * // 16
159
- * // 25
160
154
  * ```
161
155
  *
162
- * `transform` transforms an async generator into `process.stdout`, a Node.js writable stream that implements `.write`.
156
+ * Node.js `process.stdout`, a writable stream (implements the `write` method), may be used as the semigroup for `transform`
163
157
  *
164
158
  * ```javascript
165
159
  * const { pipe, compose, transform } = rubico
@@ -189,28 +183,35 @@ const _transform = function (collection, transducer, initialValue) {
189
183
  * )
190
184
  * ```
191
185
  *
192
- * If the initial value is a function it is treated as a resolver of the semigroup. The resolver may be asynchronous.
186
+ * If the initial value is a function, it is treated as a resolver of the semigroup. The resolver may be asynchronous.
193
187
  *
194
188
  * ```javascript [playground]
195
- * const promise = transform(
189
+ * const result = await transform(
196
190
  * [1, 2, 3, 4, 5],
197
191
  * Transducer.map(number => number ** 2),
198
- * async () => ['a'],
192
+ * async () => []
199
193
  * )
200
194
  *
201
- * promise.then(console.log)
195
+ * console.log(result)
202
196
  * ```
203
197
  *
204
- * Any promises passed in data argument position are resolved for their values before further execution.
198
+ * If the foldable or initial value is a promise, it is resolved for its value before further execution for the eager interface only.
205
199
  *
206
200
  * ```javascript [playground]
207
- * const promise = transform(
201
+ * const resultFromPromiseFoldable = await transform(
208
202
  * Promise.resolve([1, 2, 3, 4, 5]),
209
203
  * Transducer.map(n => n ** 2),
210
- * [],
204
+ * []
211
205
  * )
212
206
  *
213
- * promise.then(console.log) // [1, 4, 9, 16, 25]
207
+ * const resultFromPromiseSemigroup = await transform(
208
+ * [1, 2, 3, 4, 5],
209
+ * Transducer.map(n => n ** 2),
210
+ * Promise.resolve([])
211
+ * )
212
+ *
213
+ * console.log(resultFromPromiseFoldable)
214
+ * console.log(resultFromPromiseSemigroup)
214
215
  * ```
215
216
  *
216
217
  * See also: