rubico 2.6.6 → 2.7.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 (382) hide show
  1. package/Transducer.d.ts +1 -1
  2. package/Transducer.js +65 -16
  3. package/__.js +10 -1
  4. package/all.d.ts +2 -2
  5. package/all.js +11 -2
  6. package/always.js +8 -0
  7. package/and.js +6 -0
  8. package/assign.js +9 -0
  9. package/compose.js +33 -8
  10. package/curry.js +18 -0
  11. package/dist/Transducer.es.js +1 -1
  12. package/dist/Transducer.es.min.js +1 -1
  13. package/dist/Transducer.js +1 -1
  14. package/dist/Transducer.min.js +1 -1
  15. package/dist/Transducer.mjs +1 -1
  16. package/dist/__.es.js +1 -1
  17. package/dist/__.es.min.js +1 -1
  18. package/dist/__.js +1 -1
  19. package/dist/__.min.js +1 -1
  20. package/dist/__.mjs +1 -1
  21. package/dist/all.es.js +1 -1
  22. package/dist/all.es.min.js +1 -1
  23. package/dist/all.js +1 -1
  24. package/dist/all.min.js +1 -1
  25. package/dist/all.mjs +1 -1
  26. package/dist/always.es.js +1 -1
  27. package/dist/always.es.min.js +1 -1
  28. package/dist/always.js +1 -1
  29. package/dist/always.min.js +1 -1
  30. package/dist/always.mjs +1 -1
  31. package/dist/and.es.js +1 -1
  32. package/dist/and.es.min.js +1 -1
  33. package/dist/and.js +1 -1
  34. package/dist/and.min.js +1 -1
  35. package/dist/and.mjs +1 -1
  36. package/dist/assign.es.js +1 -1
  37. package/dist/assign.es.min.js +1 -1
  38. package/dist/assign.js +1 -1
  39. package/dist/assign.min.js +1 -1
  40. package/dist/assign.mjs +1 -1
  41. package/dist/compose.es.js +5 -1
  42. package/dist/compose.es.min.js +2 -2
  43. package/dist/compose.js +5 -1
  44. package/dist/compose.min.js +2 -2
  45. package/dist/compose.mjs +5 -1
  46. package/dist/curry.es.js +1 -1
  47. package/dist/curry.es.min.js +1 -1
  48. package/dist/curry.js +1 -1
  49. package/dist/curry.min.js +1 -1
  50. package/dist/curry.mjs +1 -1
  51. package/dist/eq.es.js +1 -1
  52. package/dist/eq.es.min.js +1 -1
  53. package/dist/eq.js +1 -1
  54. package/dist/eq.min.js +1 -1
  55. package/dist/eq.mjs +1 -1
  56. package/dist/every.es.js +1 -1
  57. package/dist/every.es.min.js +1 -1
  58. package/dist/every.js +1 -1
  59. package/dist/every.min.js +1 -1
  60. package/dist/every.mjs +1 -1
  61. package/dist/filter.es.js +1 -1
  62. package/dist/filter.es.min.js +1 -1
  63. package/dist/filter.js +1 -1
  64. package/dist/filter.min.js +1 -1
  65. package/dist/filter.mjs +1 -1
  66. package/dist/flatMap.es.js +1 -1
  67. package/dist/flatMap.es.min.js +1 -1
  68. package/dist/flatMap.js +1 -1
  69. package/dist/flatMap.min.js +1 -1
  70. package/dist/flatMap.mjs +1 -1
  71. package/dist/forEach.es.js +1 -1
  72. package/dist/forEach.es.min.js +1 -1
  73. package/dist/forEach.js +1 -1
  74. package/dist/forEach.min.js +1 -1
  75. package/dist/forEach.mjs +1 -1
  76. package/dist/get.es.js +1 -1
  77. package/dist/get.es.min.js +1 -1
  78. package/dist/get.js +1 -1
  79. package/dist/get.min.js +1 -1
  80. package/dist/get.mjs +1 -1
  81. package/dist/gt.es.js +1 -1
  82. package/dist/gt.es.min.js +1 -1
  83. package/dist/gt.js +1 -1
  84. package/dist/gt.min.js +1 -1
  85. package/dist/gt.mjs +1 -1
  86. package/dist/gte.es.js +1 -1
  87. package/dist/gte.es.min.js +1 -1
  88. package/dist/gte.js +1 -1
  89. package/dist/gte.min.js +1 -1
  90. package/dist/gte.mjs +1 -1
  91. package/dist/lt.es.js +1 -1
  92. package/dist/lt.es.min.js +1 -1
  93. package/dist/lt.js +1 -1
  94. package/dist/lt.min.js +1 -1
  95. package/dist/lt.mjs +1 -1
  96. package/dist/lte.es.js +1 -1
  97. package/dist/lte.es.min.js +1 -1
  98. package/dist/lte.js +1 -1
  99. package/dist/lte.min.js +1 -1
  100. package/dist/lte.mjs +1 -1
  101. package/dist/map.es.js +1 -1
  102. package/dist/map.es.min.js +1 -1
  103. package/dist/map.js +1 -1
  104. package/dist/map.min.js +1 -1
  105. package/dist/map.mjs +1 -1
  106. package/dist/not.es.js +1 -1
  107. package/dist/not.es.min.js +1 -1
  108. package/dist/not.js +1 -1
  109. package/dist/not.min.js +1 -1
  110. package/dist/not.mjs +1 -1
  111. package/dist/omit.es.js +1 -1
  112. package/dist/omit.es.min.js +1 -1
  113. package/dist/omit.js +1 -1
  114. package/dist/omit.min.js +1 -1
  115. package/dist/omit.mjs +1 -1
  116. package/dist/or.es.js +1 -1
  117. package/dist/or.es.min.js +1 -1
  118. package/dist/or.js +1 -1
  119. package/dist/or.min.js +1 -1
  120. package/dist/or.mjs +1 -1
  121. package/dist/pick.es.js +1 -1
  122. package/dist/pick.es.min.js +1 -1
  123. package/dist/pick.js +1 -1
  124. package/dist/pick.min.js +1 -1
  125. package/dist/pick.mjs +1 -1
  126. package/dist/pipe.es.js +5 -1
  127. package/dist/pipe.es.min.js +2 -2
  128. package/dist/pipe.js +5 -1
  129. package/dist/pipe.min.js +2 -2
  130. package/dist/pipe.mjs +5 -1
  131. package/dist/reduce.es.js +8 -8
  132. package/dist/reduce.es.min.js +1 -1
  133. package/dist/reduce.js +8 -8
  134. package/dist/reduce.min.js +1 -1
  135. package/dist/reduce.mjs +8 -8
  136. package/dist/rubico.es.js +16 -8
  137. package/dist/rubico.es.min.js +2 -2
  138. package/dist/rubico.global.js +16 -8
  139. package/dist/rubico.global.min.js +2 -2
  140. package/dist/rubico.js +16 -8
  141. package/dist/rubico.min.js +2 -2
  142. package/dist/rubico.mjs +16 -8
  143. package/dist/set.es.js +1 -1
  144. package/dist/set.es.min.js +1 -1
  145. package/dist/set.js +1 -1
  146. package/dist/set.min.js +1 -1
  147. package/dist/set.mjs +1 -1
  148. package/dist/some.es.js +1 -1
  149. package/dist/some.es.min.js +1 -1
  150. package/dist/some.js +1 -1
  151. package/dist/some.min.js +1 -1
  152. package/dist/some.mjs +1 -1
  153. package/dist/switchCase.es.js +1 -1
  154. package/dist/switchCase.es.min.js +1 -1
  155. package/dist/switchCase.js +1 -1
  156. package/dist/switchCase.min.js +1 -1
  157. package/dist/switchCase.mjs +1 -1
  158. package/dist/tap.es.js +1 -1
  159. package/dist/tap.es.min.js +1 -1
  160. package/dist/tap.js +1 -1
  161. package/dist/tap.min.js +1 -1
  162. package/dist/tap.mjs +1 -1
  163. package/dist/thunkify.es.js +1 -1
  164. package/dist/thunkify.es.min.js +1 -1
  165. package/dist/thunkify.js +1 -1
  166. package/dist/thunkify.min.js +1 -1
  167. package/dist/thunkify.mjs +1 -1
  168. package/dist/transform.es.js +1 -1
  169. package/dist/transform.es.min.js +1 -1
  170. package/dist/transform.js +1 -1
  171. package/dist/transform.min.js +1 -1
  172. package/dist/transform.mjs +1 -1
  173. package/dist/tryCatch.es.js +1 -1
  174. package/dist/tryCatch.es.min.js +1 -1
  175. package/dist/tryCatch.js +1 -1
  176. package/dist/tryCatch.min.js +1 -1
  177. package/dist/tryCatch.mjs +1 -1
  178. package/dist/x/append.es.js +1 -1
  179. package/dist/x/append.es.min.js +1 -1
  180. package/dist/x/append.js +1 -1
  181. package/dist/x/append.min.js +1 -1
  182. package/dist/x/append.mjs +1 -1
  183. package/dist/x/callProp.es.js +1 -1
  184. package/dist/x/callProp.es.min.js +1 -1
  185. package/dist/x/callProp.js +1 -1
  186. package/dist/x/callProp.min.js +1 -1
  187. package/dist/x/callProp.mjs +1 -1
  188. package/dist/x/defaultsDeep.es.js +1 -1
  189. package/dist/x/defaultsDeep.es.min.js +1 -1
  190. package/dist/x/defaultsDeep.js +1 -1
  191. package/dist/x/defaultsDeep.min.js +1 -1
  192. package/dist/x/defaultsDeep.mjs +1 -1
  193. package/dist/x/differenceWith.es.js +1 -1
  194. package/dist/x/differenceWith.es.min.js +1 -1
  195. package/dist/x/differenceWith.js +1 -1
  196. package/dist/x/differenceWith.min.js +1 -1
  197. package/dist/x/differenceWith.mjs +1 -1
  198. package/dist/x/filterOut.es.js +1 -1
  199. package/dist/x/filterOut.es.min.js +1 -1
  200. package/dist/x/filterOut.js +1 -1
  201. package/dist/x/filterOut.min.js +1 -1
  202. package/dist/x/filterOut.mjs +1 -1
  203. package/dist/x/find.es.js +1 -1
  204. package/dist/x/find.es.min.js +1 -1
  205. package/dist/x/find.js +1 -1
  206. package/dist/x/find.min.js +1 -1
  207. package/dist/x/find.mjs +1 -1
  208. package/dist/x/findIndex.es.js +1 -1
  209. package/dist/x/findIndex.es.min.js +1 -1
  210. package/dist/x/findIndex.js +1 -1
  211. package/dist/x/findIndex.min.js +1 -1
  212. package/dist/x/findIndex.mjs +1 -1
  213. package/dist/x/first.es.js +1 -1
  214. package/dist/x/first.es.min.js +1 -1
  215. package/dist/x/first.js +1 -1
  216. package/dist/x/first.min.js +1 -1
  217. package/dist/x/first.mjs +1 -1
  218. package/dist/x/flatten.es.js +1 -1
  219. package/dist/x/flatten.es.min.js +1 -1
  220. package/dist/x/flatten.js +1 -1
  221. package/dist/x/flatten.min.js +1 -1
  222. package/dist/x/flatten.mjs +1 -1
  223. package/dist/x/groupBy.es.js +8 -8
  224. package/dist/x/groupBy.es.min.js +1 -1
  225. package/dist/x/groupBy.js +8 -8
  226. package/dist/x/groupBy.min.js +1 -1
  227. package/dist/x/groupBy.mjs +8 -8
  228. package/dist/x/has.es.js +1 -1
  229. package/dist/x/has.es.min.js +1 -1
  230. package/dist/x/has.js +1 -1
  231. package/dist/x/has.min.js +1 -1
  232. package/dist/x/has.mjs +1 -1
  233. package/dist/x/identity.es.js +1 -1
  234. package/dist/x/identity.es.min.js +1 -1
  235. package/dist/x/identity.js +1 -1
  236. package/dist/x/identity.min.js +1 -1
  237. package/dist/x/identity.mjs +1 -1
  238. package/dist/x/includes.es.js +1 -1
  239. package/dist/x/includes.es.min.js +1 -1
  240. package/dist/x/includes.js +1 -1
  241. package/dist/x/includes.min.js +1 -1
  242. package/dist/x/includes.mjs +1 -1
  243. package/dist/x/isDeepEqual.es.js +1 -1
  244. package/dist/x/isDeepEqual.es.min.js +1 -1
  245. package/dist/x/isDeepEqual.js +1 -1
  246. package/dist/x/isDeepEqual.min.js +1 -1
  247. package/dist/x/isDeepEqual.mjs +1 -1
  248. package/dist/x/isEmpty.es.js +1 -1
  249. package/dist/x/isEmpty.es.min.js +1 -1
  250. package/dist/x/isEmpty.js +1 -1
  251. package/dist/x/isEmpty.min.js +1 -1
  252. package/dist/x/isEmpty.mjs +1 -1
  253. package/dist/x/isEqual.es.js +1 -1
  254. package/dist/x/isEqual.es.min.js +1 -1
  255. package/dist/x/isEqual.js +1 -1
  256. package/dist/x/isEqual.min.js +1 -1
  257. package/dist/x/isEqual.mjs +1 -1
  258. package/dist/x/isFunction.es.js +1 -1
  259. package/dist/x/isFunction.es.min.js +1 -1
  260. package/dist/x/isFunction.js +1 -1
  261. package/dist/x/isFunction.min.js +1 -1
  262. package/dist/x/isFunction.mjs +1 -1
  263. package/dist/x/isIn.es.js +1 -1
  264. package/dist/x/isIn.es.min.js +1 -1
  265. package/dist/x/isIn.js +1 -1
  266. package/dist/x/isIn.min.js +1 -1
  267. package/dist/x/isIn.mjs +1 -1
  268. package/dist/x/isObject.es.js +1 -1
  269. package/dist/x/isObject.es.min.js +1 -1
  270. package/dist/x/isObject.js +1 -1
  271. package/dist/x/isObject.min.js +1 -1
  272. package/dist/x/isObject.mjs +1 -1
  273. package/dist/x/isString.es.js +1 -1
  274. package/dist/x/isString.es.min.js +1 -1
  275. package/dist/x/isString.js +1 -1
  276. package/dist/x/isString.min.js +1 -1
  277. package/dist/x/isString.mjs +1 -1
  278. package/dist/x/keys.es.js +1 -1
  279. package/dist/x/keys.es.min.js +1 -1
  280. package/dist/x/keys.js +1 -1
  281. package/dist/x/keys.min.js +1 -1
  282. package/dist/x/keys.mjs +1 -1
  283. package/dist/x/last.es.js +1 -1
  284. package/dist/x/last.es.min.js +1 -1
  285. package/dist/x/last.js +1 -1
  286. package/dist/x/last.min.js +1 -1
  287. package/dist/x/last.mjs +1 -1
  288. package/dist/x/maxBy.es.js +1 -1
  289. package/dist/x/maxBy.es.min.js +1 -1
  290. package/dist/x/maxBy.js +1 -1
  291. package/dist/x/maxBy.min.js +1 -1
  292. package/dist/x/maxBy.mjs +1 -1
  293. package/dist/x/noop.es.js +1 -1
  294. package/dist/x/noop.es.min.js +1 -1
  295. package/dist/x/noop.js +1 -1
  296. package/dist/x/noop.min.js +1 -1
  297. package/dist/x/noop.mjs +1 -1
  298. package/dist/x/pluck.es.js +1 -1
  299. package/dist/x/pluck.es.min.js +1 -1
  300. package/dist/x/pluck.js +1 -1
  301. package/dist/x/pluck.min.js +1 -1
  302. package/dist/x/pluck.mjs +1 -1
  303. package/dist/x/prepend.es.js +1 -1
  304. package/dist/x/prepend.es.min.js +1 -1
  305. package/dist/x/prepend.js +1 -1
  306. package/dist/x/prepend.min.js +1 -1
  307. package/dist/x/prepend.mjs +1 -1
  308. package/dist/x/size.es.js +1 -1
  309. package/dist/x/size.es.min.js +1 -1
  310. package/dist/x/size.js +1 -1
  311. package/dist/x/size.min.js +1 -1
  312. package/dist/x/size.mjs +1 -1
  313. package/dist/x/trace.es.js +1 -1
  314. package/dist/x/trace.es.min.js +1 -1
  315. package/dist/x/trace.js +1 -1
  316. package/dist/x/trace.min.js +1 -1
  317. package/dist/x/trace.mjs +1 -1
  318. package/dist/x/unionWith.es.js +1 -1
  319. package/dist/x/unionWith.es.min.js +1 -1
  320. package/dist/x/unionWith.js +1 -1
  321. package/dist/x/unionWith.min.js +1 -1
  322. package/dist/x/unionWith.mjs +1 -1
  323. package/dist/x/uniq.es.js +1 -1
  324. package/dist/x/uniq.es.min.js +1 -1
  325. package/dist/x/uniq.js +1 -1
  326. package/dist/x/uniq.min.js +1 -1
  327. package/dist/x/uniq.mjs +1 -1
  328. package/dist/x/unless.es.js +1 -1
  329. package/dist/x/unless.es.min.js +1 -1
  330. package/dist/x/unless.js +1 -1
  331. package/dist/x/unless.min.js +1 -1
  332. package/dist/x/unless.mjs +1 -1
  333. package/dist/x/values.es.js +1 -1
  334. package/dist/x/values.es.min.js +1 -1
  335. package/dist/x/values.js +1 -1
  336. package/dist/x/values.min.js +1 -1
  337. package/dist/x/values.mjs +1 -1
  338. package/dist/x/when.es.js +1 -1
  339. package/dist/x/when.es.min.js +1 -1
  340. package/dist/x/when.js +1 -1
  341. package/dist/x/when.min.js +1 -1
  342. package/dist/x/when.mjs +1 -1
  343. package/eq.d.ts +6 -6
  344. package/eq.js +14 -6
  345. package/es.js +16 -8
  346. package/every.js +19 -5
  347. package/filter.js +59 -15
  348. package/flatMap.js +32 -23
  349. package/forEach.js +107 -13
  350. package/get.js +9 -0
  351. package/gt.js +9 -0
  352. package/gte.js +9 -0
  353. package/index.js +16 -8
  354. package/lte.js +9 -0
  355. package/map.js +153 -36
  356. package/not.js +7 -0
  357. package/omit.d.ts +2 -2
  358. package/omit.js +11 -2
  359. package/or.js +6 -0
  360. package/package.json +1 -1
  361. package/pick.js +9 -0
  362. package/pipe.js +30 -3
  363. package/reduce.js +111 -30
  364. package/set.js +9 -0
  365. package/some.js +17 -3
  366. package/switchCase.js +6 -0
  367. package/tap.js +14 -0
  368. package/thunkify.js +8 -0
  369. package/transform.js +105 -29
  370. package/tryCatch.js +5 -0
  371. package/x/append.js +3 -0
  372. package/x/callProp.js +5 -0
  373. package/x/defaultsDeep.d.ts +2 -2
  374. package/x/defaultsDeep.js +7 -2
  375. package/x/differenceWith.js +5 -0
  376. package/x/find.d.ts +2 -2
  377. package/x/find.js +2 -2
  378. package/x/groupBy.d.ts +2 -2
  379. package/x/groupBy.js +2 -2
  380. package/x/pluck.d.ts +2 -2
  381. package/x/pluck.js +2 -2
  382. package/x/unionWith.test.js +3 -3
package/set.js CHANGED
@@ -96,6 +96,15 @@ const _set = function (obj, path, value) {
96
96
  * set(Promise.resolve({}), 'a', 1).then(console.log) // { a: 1 }
97
97
  * ```
98
98
  *
99
+ * See also:
100
+ * * [pipe](/docs/pipe)
101
+ * * [all](/docs/all)
102
+ * * [assign](/docs/assign)
103
+ * * [get](/docs/get)
104
+ * * [pick](/docs/pick)
105
+ * * [omit](/docs/omit)
106
+ * * [forEach](/docs/forEach)
107
+ *
99
108
  * @since 1.7.0
100
109
  */
101
110
 
package/some.js CHANGED
@@ -40,7 +40,7 @@ const _some = function (collection, predicate) {
40
40
  *
41
41
  * @synopsis
42
42
  * ```coffeescript [specscript]
43
- * type Foldable = Array|Iterable|AsyncIterable|{ reduce: function }|Object
43
+ * type Foldable = Array|Set|Map|Generator|AsyncGenerator|{ reduce: function }|Object
44
44
  *
45
45
  * some(collection Foldable, predicate function) -> Promise|boolean
46
46
  *
@@ -48,7 +48,7 @@ const _some = function (collection, predicate) {
48
48
  * ```
49
49
  *
50
50
  * @description
51
- * Test a predicate concurrently across all items of a collection, returning true if any executions return truthy.
51
+ * Test a predicate concurrently across all items of a foldable, returning true if any executions return true.
52
52
  *
53
53
  * ```javascript [playground]
54
54
  * const isOdd = number => number % 2 == 1
@@ -58,7 +58,16 @@ const _some = function (collection, predicate) {
58
58
  * ) // true
59
59
  * ```
60
60
  *
61
- * The collection can be any iterable, async iterable, or object values iterable collection. Below is an example of `some` accepting an async generator as the collection.
61
+ * The following data types are considered to be foldables:
62
+ * * `array`
63
+ * * `set`
64
+ * * `map`
65
+ * * `generator`
66
+ * * `async generator`
67
+ * * `object with .reduce method`
68
+ * * `object`
69
+ *
70
+ * `some` works for async generators.
62
71
  *
63
72
  * ```javascript [playground]
64
73
  * const toTodosUrl = id => 'https://jsonplaceholder.typicode.com/todos/' + id
@@ -98,6 +107,11 @@ const _some = function (collection, predicate) {
98
107
  * some(Promise.resolve([1, 2, 3, 4, 5]), n => n > 6).then(console.log) // false
99
108
  * ```
100
109
  *
110
+ * See also:
111
+ * * [map](/docs/map)
112
+ * * [every](/docs/every)
113
+ * * [and](/docs/and)
114
+ *
101
115
  * @execution concurrent
102
116
  *
103
117
  * @muxing
package/switchCase.js CHANGED
@@ -91,6 +91,12 @@ const curryArgs3 = require('./_internal/curryArgs3')
91
91
  * ]) // 1 + 2 + 3 == 6
92
92
  * ```
93
93
  *
94
+ * See also:
95
+ * * [pipe](/docs/pipe)
96
+ * * [tap.if](/docs/tap.if)
97
+ * * [tryCatch](/docs/tryCatch)
98
+ * * [all](/docs/all)
99
+ *
94
100
  * @execution series
95
101
  */
96
102
  const switchCase = (...args) => {
package/tap.js CHANGED
@@ -46,6 +46,13 @@ const _tap = function (args, f) {
46
46
  * ```javascript [playground]
47
47
  * tap(Promise.resolve(1), Promise.resolve(2), 3, console.log) // 1 2 3
48
48
  * ```
49
+ *
50
+ * See also:
51
+ * * [pipe](/docs/pipe)
52
+ * * [compose](/docs/compose)
53
+ * * [tap.if](/docs/tap.if)
54
+ * * [switchCase](/docs/switchCase)
55
+ * * [tryCatch](/docs/tryCatch)
49
56
  */
50
57
  const tap = function (...args) {
51
58
  const f = args.pop()
@@ -116,6 +123,13 @@ const _tapIf = function (predicate, f, args) {
116
123
  * tap.if(Promise.resolve(1), n => n < 5, console.log) // 1
117
124
  * tap.if(Promise.resolve(6), n => n < 5, console.log)
118
125
  * ```
126
+ *
127
+ * See also:
128
+ * * [pipe](/docs/pipe)
129
+ * * [compose](/docs/compose)
130
+ * * [tap](/docs/tap)
131
+ * * [switchCase](/docs/switchCase)
132
+ * * [tryCatch](/docs/tryCatch)
119
133
  */
120
134
 
121
135
  tap.if = function (...args) {
package/thunkify.js CHANGED
@@ -22,6 +22,14 @@ const funcApply = require('./_internal/funcApply')
22
22
  *
23
23
  * console.log(thunkAdd12()) // 3
24
24
  * ```
25
+ *
26
+ * See also:
27
+ * * [eq](/docs/eq)
28
+ * * [always](/docs/always)
29
+ * * [curry](/docs/curry)
30
+ * * [__](/docs/__)
31
+ * * [Transducer.map](/docs/Transducer.map)
32
+ *
25
33
  */
26
34
  const thunkify = (func, ...args) => function thunk() {
27
35
  if (areAnyValuesPromises(args)) {
package/transform.js CHANGED
@@ -21,13 +21,11 @@ const _transform = function (collection, transducer, initialValue) {
21
21
  *
22
22
  * @synopsis
23
23
  * ```coffeescript [specscript]
24
- * type Foldable = Iterable|AsyncIterable|Object<value any>
24
+ * type Foldable = Array|Set|Map|Generator|AsyncGenerator|{ reduce: function }|Object
25
25
  *
26
26
  * type Reducer = (
27
27
  * accumulator any,
28
28
  * value any,
29
- * indexOrKey number|string,
30
- * f Foldable,
31
29
  * )=>(nextAccumulator Promise|any)
32
30
  *
33
31
  * type Transducer = Reducer=>Reducer
@@ -35,38 +33,94 @@ const _transform = function (collection, transducer, initialValue) {
35
33
  * type Semigroup =
36
34
  * Array|String|Set|TypedArray|{ concat: function }|{ write: function }|Object
37
35
  *
38
- * type SemigroupResolver = (f Foldable)=>Promise|Semigroup
36
+ * type SemigroupResolver = (fold Foldable)=>Promise|Semigroup
39
37
  *
40
38
  * transform(
41
- * f Foldable,
39
+ * fold Foldable,
42
40
  * transducer Transducer,
43
- * initialValue? Semigroup|SemigroupResolver,
41
+ * initial? Semigroup|SemigroupResolver,
44
42
  * ) -> result Promise|Semigroup
45
43
  *
46
44
  * transform(
47
45
  * transducer Transducer,
48
- * initialValue? Semigroup|SemigroupResolver,
49
- * )(f Foldable) -> result Promise|Semigroup
46
+ * initial? Semigroup|SemigroupResolver,
47
+ * )(fold Foldable) -> result Promise|Semigroup
50
48
  * ```
51
49
  *
52
50
  * @description
53
- * Transforms a foldable into a semigroup. The type of transformation depends on the type of semigroup provided as the initial value. If the initial value is a function it is treated as a resolver of the semigroup.
51
+ * Transforms a foldable with [transducers](https://rubico.land/blog/transducers-crash-course-rubico-v2) into a semigroup.
54
52
  *
55
- * The following data types are considered foldables:
56
- * * `iterable`
57
- * * `async iterable`
58
- * * `object`; only the values of the object are transformed
53
+ * The following data types are considered to be foldables:
54
+ * * `array`
55
+ * * `set`
56
+ * * `map`
57
+ * * `generator`
58
+ * * `async generator`
59
+ * * `object with .reduce method`
60
+ * * `object`
59
61
  *
60
- * The following data types are considered semigroups:
61
- * * `array`; concatenation defined by `result.concat(values)`
62
- * * `string`; concatenation defined by `result + values`
63
- * * `set`; concatenation defined by `result.add(...values)`
64
- * * `binary`; concatenation defined by `result.set(prevResult); result.set(values, offset)`
65
- * * `{ concat: function }`; concatenation defined by `result.concat(values)`
66
- * * `{ write: function }`; concatenation defined by `result.write(item)`
67
- * * `object`; concatenation defined by `({ ...result, ...values })`
62
+ * 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:
68
63
  *
69
- * `transform` can transform any of the above collections into any of the other above collections.
64
+ * ```coffeescript [specscript]
65
+ * type Reducer = (
66
+ * accumulator any,
67
+ * value any,
68
+ * )=>(nextAccumulator Promise|any)
69
+ *
70
+ * type Transducer = Reducer=>Reducer
71
+ * ```
72
+ *
73
+ * The following data types are considered to be semigroups:
74
+ * * `array`
75
+ * * `string`
76
+ * * `set`
77
+ * * `binary`
78
+ * * `{ concat: function }`
79
+ * * `{ write: function }`
80
+ * * `object`
81
+ *
82
+ * The concatenation operation changes depending on the provided semigroup:
83
+ *
84
+ * If the semigroup is an array, concatenation is defined as:
85
+ * ```javascript
86
+ * nextAccumulator = accumulator.concat(values)
87
+ * ```
88
+ *
89
+ * If the semigroup is a string, concatenation is defined as:
90
+ * ```javascript
91
+ * nextAccumulator = accumulator + values
92
+ * ```
93
+ *
94
+ * If the semigroup is a set, concatenation is defined as:
95
+ * ```javascript
96
+ * nextAccumulator = accumulator.add(...values)
97
+ * ```
98
+ *
99
+ * If the semigroup is binary, concatenation is defined as:
100
+ * ```javascript
101
+ * nextAccumulator = new accumulator.constructor(accumulator.length + values.length)
102
+ * nextAccumulator.set(accumulator)
103
+ * nextAccumulator.set(values, accumulator.length)
104
+ * ```
105
+ *
106
+ * If the semigroup is an object with a `.concat` method, concatenation is defined as:
107
+ * ```javascript
108
+ * nextAccumulator = accumulator
109
+ * accumulator.concat(values)
110
+ * ```
111
+ *
112
+ * If the semigroup is an object with a `.write` method, concatenation is defined as:
113
+ * ```javascript
114
+ * nextAccumulator = accumulator
115
+ * accumulator.write(values)
116
+ * ```
117
+ *
118
+ * If the semigroup is a plain object, concatenation is defined as:
119
+ * ```javascript
120
+ * nextAccumulator = ({ ...accumulator, ...values })
121
+ * ```
122
+ *
123
+ * `transform` transforms numbers from an array into another array.
70
124
  *
71
125
  * ```javascript [playground]
72
126
  * const square = number => number ** 2
@@ -80,22 +134,22 @@ const _transform = function (collection, transducer, initialValue) {
80
134
  *
81
135
  * // transform arrays into arrays
82
136
  * console.log(
83
- * transform(squaredOdds, [])([1, 2, 3, 4, 5])
137
+ * transform([1, 2, 3, 4, 5], squaredOdds, [])
84
138
  * ) // [1, 9, 25]
85
139
  *
86
140
  * // transform arrays into strings
87
141
  * console.log(
88
- * transform(squaredOdds, '')([1, 2, 3, 4, 5])
142
+ * transform([1, 2, 3, 4, 5], squaredOdds, '')
89
143
  * ) // '1925'
90
144
  *
91
145
  * // transform arrays into sets
92
146
  * console.log(
93
- * transform(squaredOdds, new Set())([1, 2, 3, 4, 5])
147
+ * transform([1, 2, 3, 4, 5], squaredOdds, new Set())
94
148
  * ) // Set (3) { 1, 9, 25 }
95
149
  *
96
150
  * // transform arrays into typed arrays
97
151
  * console.log(
98
- * transform(squaredOdds, new Uint8Array())([1, 2, 3, 4, 5]),
152
+ * transform([1, 2, 3, 4, 5], squaredOdds, new Uint8Array()),
99
153
  * ) // Uint8Array(3) [ 1, 9, 25 ]
100
154
  * ```
101
155
  *
@@ -111,7 +165,7 @@ const _transform = function (collection, transducer, initialValue) {
111
165
  * },
112
166
  * }
113
167
  *
114
- * transform(Transducer.map(square), Stdout)([1, 2, 3, 4, 5])
168
+ * transform([1, 2, 3, 4, 5], Transducer.map(square), Stdout)
115
169
  * // 1
116
170
  * // 4
117
171
  * // 9
@@ -149,16 +203,38 @@ const _transform = function (collection, transducer, initialValue) {
149
203
  * )
150
204
  * ```
151
205
  *
206
+ * If the initial value is a function it is treated as a resolver of the semigroup. The resolver may be asynchronous.
207
+ *
208
+ * ```javascript [playground]
209
+ * const promise = transform(
210
+ * [1, 2, 3, 4, 5],
211
+ * Transducer.map(number => number ** 2),
212
+ * async () => ['a'],
213
+ * )
214
+ *
215
+ * promise.then(console.log)
216
+ * ```
217
+ *
152
218
  * Any promises passed in argument position are resolved for their values before further execution. This only applies to the eager version of the API.
153
219
  *
154
220
  * ```javascript [playground]
155
- * transform(
221
+ * const promise = transform(
156
222
  * Promise.resolve([1, 2, 3, 4, 5]),
157
223
  * Transducer.map(n => n ** 2),
158
224
  * [],
159
- * ).then(console.log) // [1, 4, 9, 16, 25]
225
+ * )
226
+ *
227
+ * promise.then(console.log) // [1, 4, 9, 16, 25]
160
228
  * ```
161
229
  *
230
+ * See also:
231
+ * * [forEach](/docs/forEach)
232
+ * * [map](/docs/map)
233
+ * * [filter](/docs/filter)
234
+ * * [reduce](/docs/reduce)
235
+ * * [flatMap](/docs/flatMap)
236
+ * * [some](/docs/some)
237
+ *
162
238
  * @execution series
163
239
  *
164
240
  * @transducing
package/tryCatch.js CHANGED
@@ -75,6 +75,11 @@ const _tryCatch = function (tryer, catcher, args) {
75
75
  * console.error(`${a} + ${b} + ${c}: ${error.message}`)
76
76
  * })
77
77
  * ```
78
+ *
79
+ * See also:
80
+ * * [pipe](/docs/pipe)
81
+ * * [switchCase](/docs/switchCase)
82
+ * * [all](/docs/all)
78
83
  */
79
84
 
80
85
  const tryCatch = function (...args) {
package/x/append.js CHANGED
@@ -35,6 +35,9 @@ const isArray = require('../_internal/isArray')
35
35
  * }
36
36
  * ```
37
37
  *
38
+ * See also:
39
+ * * [callProp](/docs/callProp)
40
+ *
38
41
  * @since 1.7.3
39
42
  */
40
43
 
package/x/callProp.js CHANGED
@@ -15,6 +15,11 @@
15
15
  * const priceRoundedDown = callProp('toFixed', 2)(5.992)
16
16
  * console.log('priceRoundedDown:', priceRoundedDown) // '5.99'
17
17
  * ```
18
+ *
19
+ * See also:
20
+ * * [append](/docs/append)
21
+ * * [defaultsDeep](/docs/defaultsDeep)
22
+ *
18
23
  */
19
24
  const callProp = (property, ...args) => function callingProp(object) {
20
25
  return object[property](...args)
@@ -26,11 +26,11 @@ export = defaultsDeep;
26
26
  * })
27
27
  *
28
28
  * console.log(defaultUser({
29
- * name: 'George',
29
+ * name: 'John',
30
30
  * images: [{ url: 'https://via.placeholder.com/150/0000FF/808080%20?Text=Digital.com' }],
31
31
  * }))
32
32
  * // {
33
- * // name: 'George',
33
+ * // name: 'John',
34
34
  * // images: [
35
35
  * // { url: 'https://via.placeholder.com/150/0000FF/808080%20?Text=Digital.com' },
36
36
  * // { url: 'https://via.placeholder.com/150' },
package/x/defaultsDeep.js CHANGED
@@ -91,11 +91,11 @@ const objectDefaultsDeepFromObject = function (object, defaultObject) {
91
91
  * })
92
92
  *
93
93
  * console.log(defaultUser({
94
- * name: 'George',
94
+ * name: 'John',
95
95
  * images: [{ url: 'https://via.placeholder.com/150/0000FF/808080%20?Text=Digital.com' }],
96
96
  * }))
97
97
  * // {
98
- * // name: 'George',
98
+ * // name: 'John',
99
99
  * // images: [
100
100
  * // { url: 'https://via.placeholder.com/150/0000FF/808080%20?Text=Digital.com' },
101
101
  * // { url: 'https://via.placeholder.com/150' },
@@ -103,6 +103,11 @@ const objectDefaultsDeepFromObject = function (object, defaultObject) {
103
103
  * // ],
104
104
  * // }
105
105
  * ```
106
+ *
107
+ * See also:
108
+ * * [callProp](/docs/callProp)
109
+ * * [differenceWith](/docs/differenceWith)
110
+ *
106
111
  */
107
112
  const defaultsDeep = defaultCollection => function defaulting(value) {
108
113
  if (isArray(value) && isArray(defaultCollection)) {
@@ -96,6 +96,11 @@ const differenceWithArray = function (comparator, allValues, array) {
96
96
  * differenceWith(isDeepEqual, [{ a: 1 }, { b: 2 }, { c: 3 }])([{ b: 2 }]),
97
97
  * ) // [{ a: 1 }, { c: 3 }]
98
98
  * ```
99
+ *
100
+ * See also:
101
+ * * [defaultsDeep](/docs/defaultsDeep)
102
+ * * [filterOut](/docs/filterOut)
103
+ *
99
104
  */
100
105
  const differenceWith = (
101
106
  comparator, allValues,
package/x/find.d.ts CHANGED
@@ -23,12 +23,12 @@ export = find;
23
23
  * const users = [
24
24
  * { name: 'John', age: 16 },
25
25
  * { name: 'Jill', age: 32 },
26
- * { name: 'George', age: 51 },
26
+ * { name: 'John', age: 51 },
27
27
  * ]
28
28
  *
29
29
  * console.log(
30
30
  * find(user => user.age > 50)(users),
31
- * ) // { name: 'George', age: 51 }
31
+ * ) // { name: 'John', age: 51 }
32
32
  * ```
33
33
  */
34
34
  declare function find(predicate: any): (value: any) => any;
package/x/find.js CHANGED
@@ -30,12 +30,12 @@ const asyncIteratorFind = require('../_internal/asyncIteratorFind')
30
30
  * const users = [
31
31
  * { name: 'John', age: 16 },
32
32
  * { name: 'Jill', age: 32 },
33
- * { name: 'George', age: 51 },
33
+ * { name: 'John', age: 51 },
34
34
  * ]
35
35
  *
36
36
  * console.log(
37
37
  * find(user => user.age > 50)(users),
38
- * ) // { name: 'George', age: 51 }
38
+ * ) // { name: 'John', age: 51 }
39
39
  * ```
40
40
  */
41
41
  const find = predicate => function finding(value) {
package/x/groupBy.d.ts CHANGED
@@ -24,13 +24,13 @@ export = groupBy;
24
24
  *
25
25
  * console.log(
26
26
  * groupBy('age')([
27
- * { name: 'George', age: 22 },
27
+ * { name: 'John', age: 22 },
28
28
  * { name: 'Jane', age: 22 },
29
29
  * { name: 'Henry', age: 23 },
30
30
  * ]),
31
31
  * )
32
32
  * // Map {
33
- * // 22 => [{ name: 'George', age: 22 }, { name: 'Jane', age: 22 }],
33
+ * // 22 => [{ name: 'John', age: 22 }, { name: 'Jane', age: 22 }],
34
34
  * // 23 => [{ name: 'Henry', age: 23 }],
35
35
  * // }
36
36
  * ```
package/x/groupBy.js CHANGED
@@ -59,13 +59,13 @@ const groupByResolver = resolver => function groupByResolverReducer(
59
59
  *
60
60
  * console.log(
61
61
  * groupBy('age')([
62
- * { name: 'George', age: 22 },
62
+ * { name: 'John', age: 22 },
63
63
  * { name: 'Jane', age: 22 },
64
64
  * { name: 'Henry', age: 23 },
65
65
  * ]),
66
66
  * )
67
67
  * // Map {
68
- * // 22 => [{ name: 'George', age: 22 }, { name: 'Jane', age: 22 }],
68
+ * // 22 => [{ name: 'John', age: 22 }, { name: 'Jane', age: 22 }],
69
69
  * // 23 => [{ name: 'Henry', age: 23 }],
70
70
  * // }
71
71
  * ```
package/x/pluck.d.ts CHANGED
@@ -22,14 +22,14 @@ export = pluck;
22
22
  * import pluck from 'https://unpkg.com/rubico/dist/x/pluck.es.js'
23
23
  *
24
24
  * const users = [
25
- * { name: 'George', age: 33 },
25
+ * { name: 'John', age: 33 },
26
26
  * { name: 'Jane', age: 51 },
27
27
  * { name: 'Jim', age: 22 },
28
28
  * ]
29
29
  *
30
30
  * const usernames = pluck(users, 'name')
31
31
  *
32
- * console.log(usernames) // ['George', 'Jane', 'Jim']
32
+ * console.log(usernames) // ['John', 'Jane', 'Jim']
33
33
  * ```
34
34
  */
35
35
  declare function pluck(...args: any[]): any;
package/x/pluck.js CHANGED
@@ -25,14 +25,14 @@ const get = require('../get')
25
25
  * import pluck from 'https://unpkg.com/rubico/dist/x/pluck.es.js'
26
26
  *
27
27
  * const users = [
28
- * { name: 'George', age: 33 },
28
+ * { name: 'John', age: 33 },
29
29
  * { name: 'Jane', age: 51 },
30
30
  * { name: 'Jim', age: 22 },
31
31
  * ]
32
32
  *
33
33
  * const usernames = pluck(users, 'name')
34
34
  *
35
- * console.log(usernames) // ['George', 'Jane', 'Jim']
35
+ * console.log(usernames) // ['John', 'Jane', 'Jim']
36
36
  * ```
37
37
  */
38
38
  const pluck = function (...args) {
@@ -102,14 +102,14 @@ describe('unionWith', () => {
102
102
  assert.deepEqual(result, new Set([1, 2, 3]))
103
103
  })
104
104
  it('predicate item => item.name; values Set<[{...}, {...}, {...}]>; result Promise|<Set<[{...}, {...}]>>', async () => {
105
- const people = new Set([{ name: 'George' }, { name: 'George' }, { name: 'Jim' }])
105
+ const people = new Set([{ name: 'John' }, { name: 'John' }, { name: 'Jim' }])
106
106
  const result = unionWith((personA, personB) => personA.name === personB.name)(people)
107
- assert.deepEqual(result, new Set([{ name: 'George' }, { name: 'Jim' }]))
107
+ assert.deepEqual(result, new Set([{ name: 'John' }, { name: 'Jim' }]))
108
108
  {
109
109
  const p = unionWith(async (personA, personB) => personA.name === personB.name)(people)
110
110
  assert(p instanceof Promise)
111
111
  const result = await p
112
- assert.deepEqual(result, new Set([{ name: 'George' }, { name: 'Jim' }]))
112
+ assert.deepEqual(result, new Set([{ name: 'John' }, { name: 'Jim' }]))
113
113
  }
114
114
  })
115
115
  it('predicate () => false; values Set<[[1], 2, [3]]>; result Set<[1, 2, 3]>', async () => {