rubico 2.10.0 → 2.12.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 (362) hide show
  1. package/README.md +16 -20
  2. package/Transducer.js +37 -58
  3. package/__.js +3 -3
  4. package/_internal/FilteringAsyncIterator.js +74 -23
  5. package/always.js +4 -4
  6. package/and.js +34 -26
  7. package/assign.js +2 -2
  8. package/compose.js +1 -0
  9. package/curry.js +48 -28
  10. package/dist/Transducer.es.js +1 -1
  11. package/dist/Transducer.es.min.js +1 -1
  12. package/dist/Transducer.js +1 -1
  13. package/dist/Transducer.min.js +1 -1
  14. package/dist/Transducer.mjs +1 -1
  15. package/dist/__.es.js +1 -1
  16. package/dist/__.es.min.js +1 -1
  17. package/dist/__.js +1 -1
  18. package/dist/__.min.js +1 -1
  19. package/dist/__.mjs +1 -1
  20. package/dist/all.es.js +1 -1
  21. package/dist/all.es.min.js +1 -1
  22. package/dist/all.js +1 -1
  23. package/dist/all.min.js +1 -1
  24. package/dist/all.mjs +1 -1
  25. package/dist/always.es.js +1 -1
  26. package/dist/always.es.min.js +1 -1
  27. package/dist/always.js +1 -1
  28. package/dist/always.min.js +1 -1
  29. package/dist/always.mjs +1 -1
  30. package/dist/and.es.js +1 -1
  31. package/dist/and.es.min.js +1 -1
  32. package/dist/and.js +1 -1
  33. package/dist/and.min.js +1 -1
  34. package/dist/and.mjs +1 -1
  35. package/dist/assign.es.js +1 -1
  36. package/dist/assign.es.min.js +1 -1
  37. package/dist/assign.js +1 -1
  38. package/dist/assign.min.js +1 -1
  39. package/dist/assign.mjs +1 -1
  40. package/dist/compose.es.js +1 -1
  41. package/dist/compose.es.min.js +1 -1
  42. package/dist/compose.js +1 -1
  43. package/dist/compose.min.js +1 -1
  44. package/dist/compose.mjs +1 -1
  45. package/dist/curry.es.js +1 -1
  46. package/dist/curry.es.min.js +1 -1
  47. package/dist/curry.js +1 -1
  48. package/dist/curry.min.js +1 -1
  49. package/dist/curry.mjs +1 -1
  50. package/dist/eq.es.js +1 -1
  51. package/dist/eq.es.min.js +1 -1
  52. package/dist/eq.js +1 -1
  53. package/dist/eq.min.js +1 -1
  54. package/dist/eq.mjs +1 -1
  55. package/dist/every.es.js +1 -1
  56. package/dist/every.es.min.js +1 -1
  57. package/dist/every.js +1 -1
  58. package/dist/every.min.js +1 -1
  59. package/dist/every.mjs +1 -1
  60. package/dist/filter.es.js +113 -19
  61. package/dist/filter.es.min.js +2 -2
  62. package/dist/filter.js +113 -19
  63. package/dist/filter.min.js +2 -2
  64. package/dist/filter.mjs +113 -19
  65. package/dist/flatMap.es.js +1 -1
  66. package/dist/flatMap.es.min.js +1 -1
  67. package/dist/flatMap.js +1 -1
  68. package/dist/flatMap.min.js +1 -1
  69. package/dist/flatMap.mjs +1 -1
  70. package/dist/forEach.es.js +1 -1
  71. package/dist/forEach.es.min.js +1 -1
  72. package/dist/forEach.js +1 -1
  73. package/dist/forEach.min.js +1 -1
  74. package/dist/forEach.mjs +1 -1
  75. package/dist/get.es.js +1 -1
  76. package/dist/get.es.min.js +1 -1
  77. package/dist/get.js +1 -1
  78. package/dist/get.min.js +1 -1
  79. package/dist/get.mjs +1 -1
  80. package/dist/gt.es.js +1 -1
  81. package/dist/gt.es.min.js +1 -1
  82. package/dist/gt.js +1 -1
  83. package/dist/gt.min.js +1 -1
  84. package/dist/gt.mjs +1 -1
  85. package/dist/gte.es.js +1 -1
  86. package/dist/gte.es.min.js +1 -1
  87. package/dist/gte.js +1 -1
  88. package/dist/gte.min.js +1 -1
  89. package/dist/gte.mjs +1 -1
  90. package/dist/lt.es.js +1 -1
  91. package/dist/lt.es.min.js +1 -1
  92. package/dist/lt.js +1 -1
  93. package/dist/lt.min.js +1 -1
  94. package/dist/lt.mjs +1 -1
  95. package/dist/lte.es.js +1 -1
  96. package/dist/lte.es.min.js +1 -1
  97. package/dist/lte.js +1 -1
  98. package/dist/lte.min.js +1 -1
  99. package/dist/lte.mjs +1 -1
  100. package/dist/map.es.js +1 -1
  101. package/dist/map.es.min.js +1 -1
  102. package/dist/map.js +1 -1
  103. package/dist/map.min.js +1 -1
  104. package/dist/map.mjs +1 -1
  105. package/dist/not.es.js +1 -1
  106. package/dist/not.es.min.js +1 -1
  107. package/dist/not.js +1 -1
  108. package/dist/not.min.js +1 -1
  109. package/dist/not.mjs +1 -1
  110. package/dist/omit.es.js +1 -1
  111. package/dist/omit.es.min.js +1 -1
  112. package/dist/omit.js +1 -1
  113. package/dist/omit.min.js +1 -1
  114. package/dist/omit.mjs +1 -1
  115. package/dist/or.es.js +1 -1
  116. package/dist/or.es.min.js +1 -1
  117. package/dist/or.js +1 -1
  118. package/dist/or.min.js +1 -1
  119. package/dist/or.mjs +1 -1
  120. package/dist/pick.es.js +1 -1
  121. package/dist/pick.es.min.js +1 -1
  122. package/dist/pick.js +1 -1
  123. package/dist/pick.min.js +1 -1
  124. package/dist/pick.mjs +1 -1
  125. package/dist/pipe.es.js +1 -1
  126. package/dist/pipe.es.min.js +1 -1
  127. package/dist/pipe.js +1 -1
  128. package/dist/pipe.min.js +1 -1
  129. package/dist/pipe.mjs +1 -1
  130. package/dist/reduce.es.js +1 -1
  131. package/dist/reduce.es.min.js +1 -1
  132. package/dist/reduce.js +1 -1
  133. package/dist/reduce.min.js +1 -1
  134. package/dist/reduce.mjs +1 -1
  135. package/dist/rubico.es.js +57 -19
  136. package/dist/rubico.es.min.js +2 -2
  137. package/dist/rubico.global.js +57 -19
  138. package/dist/rubico.global.min.js +2 -2
  139. package/dist/rubico.js +57 -19
  140. package/dist/rubico.min.js +2 -2
  141. package/dist/rubico.mjs +57 -19
  142. package/dist/set.es.js +1 -1
  143. package/dist/set.es.min.js +1 -1
  144. package/dist/set.js +1 -1
  145. package/dist/set.min.js +1 -1
  146. package/dist/set.mjs +1 -1
  147. package/dist/some.es.js +1 -1
  148. package/dist/some.es.min.js +1 -1
  149. package/dist/some.js +1 -1
  150. package/dist/some.min.js +1 -1
  151. package/dist/some.mjs +1 -1
  152. package/dist/switchCase.es.js +1 -1
  153. package/dist/switchCase.es.min.js +1 -1
  154. package/dist/switchCase.js +1 -1
  155. package/dist/switchCase.min.js +1 -1
  156. package/dist/switchCase.mjs +1 -1
  157. package/dist/tap.es.js +1 -1
  158. package/dist/tap.es.min.js +1 -1
  159. package/dist/tap.js +1 -1
  160. package/dist/tap.min.js +1 -1
  161. package/dist/tap.mjs +1 -1
  162. package/dist/thunkify.es.js +1 -1
  163. package/dist/thunkify.es.min.js +1 -1
  164. package/dist/thunkify.js +1 -1
  165. package/dist/thunkify.min.js +1 -1
  166. package/dist/thunkify.mjs +1 -1
  167. package/dist/transform.es.js +1 -1
  168. package/dist/transform.es.min.js +1 -1
  169. package/dist/transform.js +1 -1
  170. package/dist/transform.min.js +1 -1
  171. package/dist/transform.mjs +1 -1
  172. package/dist/tryCatch.es.js +1 -1
  173. package/dist/tryCatch.es.min.js +1 -1
  174. package/dist/tryCatch.js +1 -1
  175. package/dist/tryCatch.min.js +1 -1
  176. package/dist/tryCatch.mjs +1 -1
  177. package/dist/x/append.es.js +1 -1
  178. package/dist/x/append.es.min.js +1 -1
  179. package/dist/x/append.js +1 -1
  180. package/dist/x/append.min.js +1 -1
  181. package/dist/x/append.mjs +1 -1
  182. package/dist/x/callProp.es.js +1 -1
  183. package/dist/x/callProp.es.min.js +1 -1
  184. package/dist/x/callProp.js +1 -1
  185. package/dist/x/callProp.min.js +1 -1
  186. package/dist/x/callProp.mjs +1 -1
  187. package/dist/x/defaultsDeep.es.js +1 -1
  188. package/dist/x/defaultsDeep.es.min.js +1 -1
  189. package/dist/x/defaultsDeep.js +1 -1
  190. package/dist/x/defaultsDeep.min.js +1 -1
  191. package/dist/x/defaultsDeep.mjs +1 -1
  192. package/dist/x/differenceWith.es.js +1 -1
  193. package/dist/x/differenceWith.es.min.js +1 -1
  194. package/dist/x/differenceWith.js +1 -1
  195. package/dist/x/differenceWith.min.js +1 -1
  196. package/dist/x/differenceWith.mjs +1 -1
  197. package/dist/x/filterOut.es.js +113 -19
  198. package/dist/x/filterOut.es.min.js +2 -2
  199. package/dist/x/filterOut.js +113 -19
  200. package/dist/x/filterOut.min.js +2 -2
  201. package/dist/x/filterOut.mjs +113 -19
  202. package/dist/x/find.es.js +1 -1
  203. package/dist/x/find.es.min.js +1 -1
  204. package/dist/x/find.js +1 -1
  205. package/dist/x/find.min.js +1 -1
  206. package/dist/x/find.mjs +1 -1
  207. package/dist/x/findIndex.es.js +1 -1
  208. package/dist/x/findIndex.es.min.js +1 -1
  209. package/dist/x/findIndex.js +1 -1
  210. package/dist/x/findIndex.min.js +1 -1
  211. package/dist/x/findIndex.mjs +1 -1
  212. package/dist/x/first.es.js +1 -1
  213. package/dist/x/first.es.min.js +1 -1
  214. package/dist/x/first.js +1 -1
  215. package/dist/x/first.min.js +1 -1
  216. package/dist/x/first.mjs +1 -1
  217. package/dist/x/flatten.es.js +1 -1
  218. package/dist/x/flatten.es.min.js +1 -1
  219. package/dist/x/flatten.js +1 -1
  220. package/dist/x/flatten.min.js +1 -1
  221. package/dist/x/flatten.mjs +1 -1
  222. package/dist/x/groupBy.es.js +1 -1
  223. package/dist/x/groupBy.es.min.js +1 -1
  224. package/dist/x/groupBy.js +1 -1
  225. package/dist/x/groupBy.min.js +1 -1
  226. package/dist/x/groupBy.mjs +1 -1
  227. package/dist/x/has.es.js +1 -1
  228. package/dist/x/has.es.min.js +1 -1
  229. package/dist/x/has.js +1 -1
  230. package/dist/x/has.min.js +1 -1
  231. package/dist/x/has.mjs +1 -1
  232. package/dist/x/identity.es.js +1 -1
  233. package/dist/x/identity.es.min.js +1 -1
  234. package/dist/x/identity.js +1 -1
  235. package/dist/x/identity.min.js +1 -1
  236. package/dist/x/identity.mjs +1 -1
  237. package/dist/x/includes.es.js +1 -1
  238. package/dist/x/includes.es.min.js +1 -1
  239. package/dist/x/includes.js +1 -1
  240. package/dist/x/includes.min.js +1 -1
  241. package/dist/x/includes.mjs +1 -1
  242. package/dist/x/isDeepEqual.es.js +1 -1
  243. package/dist/x/isDeepEqual.es.min.js +1 -1
  244. package/dist/x/isDeepEqual.js +1 -1
  245. package/dist/x/isDeepEqual.min.js +1 -1
  246. package/dist/x/isDeepEqual.mjs +1 -1
  247. package/dist/x/isEmpty.es.js +1 -1
  248. package/dist/x/isEmpty.es.min.js +1 -1
  249. package/dist/x/isEmpty.js +1 -1
  250. package/dist/x/isEmpty.min.js +1 -1
  251. package/dist/x/isEmpty.mjs +1 -1
  252. package/dist/x/isEqual.es.js +1 -1
  253. package/dist/x/isEqual.es.min.js +1 -1
  254. package/dist/x/isEqual.js +1 -1
  255. package/dist/x/isEqual.min.js +1 -1
  256. package/dist/x/isEqual.mjs +1 -1
  257. package/dist/x/isFunction.es.js +1 -1
  258. package/dist/x/isFunction.es.min.js +1 -1
  259. package/dist/x/isFunction.js +1 -1
  260. package/dist/x/isFunction.min.js +1 -1
  261. package/dist/x/isFunction.mjs +1 -1
  262. package/dist/x/isIn.es.js +1 -1
  263. package/dist/x/isIn.es.min.js +1 -1
  264. package/dist/x/isIn.js +1 -1
  265. package/dist/x/isIn.min.js +1 -1
  266. package/dist/x/isIn.mjs +1 -1
  267. package/dist/x/isObject.es.js +1 -1
  268. package/dist/x/isObject.es.min.js +1 -1
  269. package/dist/x/isObject.js +1 -1
  270. package/dist/x/isObject.min.js +1 -1
  271. package/dist/x/isObject.mjs +1 -1
  272. package/dist/x/isString.es.js +1 -1
  273. package/dist/x/isString.es.min.js +1 -1
  274. package/dist/x/isString.js +1 -1
  275. package/dist/x/isString.min.js +1 -1
  276. package/dist/x/isString.mjs +1 -1
  277. package/dist/x/keys.es.js +1 -1
  278. package/dist/x/keys.es.min.js +1 -1
  279. package/dist/x/keys.js +1 -1
  280. package/dist/x/keys.min.js +1 -1
  281. package/dist/x/keys.mjs +1 -1
  282. package/dist/x/last.es.js +1 -1
  283. package/dist/x/last.es.min.js +1 -1
  284. package/dist/x/last.js +1 -1
  285. package/dist/x/last.min.js +1 -1
  286. package/dist/x/last.mjs +1 -1
  287. package/dist/x/maxBy.es.js +1 -1
  288. package/dist/x/maxBy.es.min.js +1 -1
  289. package/dist/x/maxBy.js +1 -1
  290. package/dist/x/maxBy.min.js +1 -1
  291. package/dist/x/maxBy.mjs +1 -1
  292. package/dist/x/noop.es.js +1 -1
  293. package/dist/x/noop.es.min.js +1 -1
  294. package/dist/x/noop.js +1 -1
  295. package/dist/x/noop.min.js +1 -1
  296. package/dist/x/noop.mjs +1 -1
  297. package/dist/x/pluck.es.js +1 -1
  298. package/dist/x/pluck.es.min.js +1 -1
  299. package/dist/x/pluck.js +1 -1
  300. package/dist/x/pluck.min.js +1 -1
  301. package/dist/x/pluck.mjs +1 -1
  302. package/dist/x/prepend.es.js +1 -1
  303. package/dist/x/prepend.es.min.js +1 -1
  304. package/dist/x/prepend.js +1 -1
  305. package/dist/x/prepend.min.js +1 -1
  306. package/dist/x/prepend.mjs +1 -1
  307. package/dist/x/size.es.js +1 -1
  308. package/dist/x/size.es.min.js +1 -1
  309. package/dist/x/size.js +1 -1
  310. package/dist/x/size.min.js +1 -1
  311. package/dist/x/size.mjs +1 -1
  312. package/dist/x/trace.es.js +1 -1
  313. package/dist/x/trace.es.min.js +1 -1
  314. package/dist/x/trace.js +1 -1
  315. package/dist/x/trace.min.js +1 -1
  316. package/dist/x/trace.mjs +1 -1
  317. package/dist/x/unionWith.es.js +1 -1
  318. package/dist/x/unionWith.es.min.js +1 -1
  319. package/dist/x/unionWith.js +1 -1
  320. package/dist/x/unionWith.min.js +1 -1
  321. package/dist/x/unionWith.mjs +1 -1
  322. package/dist/x/uniq.es.js +1 -1
  323. package/dist/x/uniq.es.min.js +1 -1
  324. package/dist/x/uniq.js +1 -1
  325. package/dist/x/uniq.min.js +1 -1
  326. package/dist/x/uniq.mjs +1 -1
  327. package/dist/x/unless.es.js +1 -1
  328. package/dist/x/unless.es.min.js +1 -1
  329. package/dist/x/unless.js +1 -1
  330. package/dist/x/unless.min.js +1 -1
  331. package/dist/x/unless.mjs +1 -1
  332. package/dist/x/values.es.js +1 -1
  333. package/dist/x/values.es.min.js +1 -1
  334. package/dist/x/values.js +1 -1
  335. package/dist/x/values.min.js +1 -1
  336. package/dist/x/values.mjs +1 -1
  337. package/dist/x/when.es.js +1 -1
  338. package/dist/x/when.es.min.js +1 -1
  339. package/dist/x/when.js +1 -1
  340. package/dist/x/when.min.js +1 -1
  341. package/dist/x/when.mjs +1 -1
  342. package/eq.js +29 -30
  343. package/es.js +57 -19
  344. package/every.js +14 -20
  345. package/filter.js +48 -86
  346. package/flatMap.js +13 -13
  347. package/forEach.js +8 -8
  348. package/get.js +3 -3
  349. package/gt.js +18 -25
  350. package/gte.js +22 -29
  351. package/index.js +57 -19
  352. package/lt.js +33 -31
  353. package/lte.js +24 -31
  354. package/map.js +37 -41
  355. package/not.js +12 -17
  356. package/or.js +34 -26
  357. package/package.json +1 -1
  358. package/reduce.js +60 -67
  359. package/some.js +11 -34
  360. package/switchCase.js +3 -3
  361. package/thunkify.js +42 -12
  362. package/transform.js +57 -56
package/lt.js CHANGED
@@ -6,44 +6,37 @@ const lessThan = require('./_internal/lessThan')
6
6
  *
7
7
  * @synopsis
8
8
  * ```coffeescript [specscript]
9
- * args Array<any>
10
- * argsOrPromises Array<Promise|any>
11
- *
12
- * type SyncOrAsyncResolver = (...args)=>Promise|any
13
- *
14
- * leftValue Promise|any
15
- * rightValue Promise|any
16
- * leftResolver SyncOrAsyncResolver
17
- * rightResolver SyncOrAsyncResolver
18
- *
19
- * lt(leftValue, rightValue) -> Promise|boolean
20
- * lt(...argsOrPromises, leftResolver, rightValue) -> Promise|boolean
21
- * lt(...argsOrPromises, leftValue, rightResolver) -> Promise|boolean
22
- * lt(...argsOrPromises, leftResolver, rightResolver) -> Promise|boolean
23
- * lt(leftResolver, rightValue)(...args) -> Promise|boolean
24
- * lt(leftValue, rightResolver)(...args) -> Promise|boolean
25
- * lt(leftResolver, rightResolver)(...args) -> Promise|boolean
9
+ * type SyncOrAsyncResolver = (...arguments)=>Promise|any
10
+ *
11
+ * lt(leftValue Promise|any, rightValue Promise|any) -> Promise|boolean
12
+ * lt(...arguments, leftResolver SyncOrAsyncResolver, rightValue Promise|any) -> Promise|boolean
13
+ * lt(...arguments, leftValue Promise|any, rightResolver SyncOrAsyncResolver) -> Promise|boolean
14
+ * lt(...arguments, leftResolver SyncOrAsyncResolver, rightResolver SyncOrAsyncResolver) -> Promise|boolean
15
+ *
16
+ * lt(leftResolver SyncOrAsyncResolver, rightValue Promise|any)(...arguments) -> Promise|boolean
17
+ * lt(leftValue Promise|any, rightResolver SyncOrAsyncResolver)(...arguments) -> Promise|boolean
18
+ * lt(leftResolver SyncOrAsyncResolver, rightResolver SyncOrAsyncResolver)(...arguments) -> Promise|boolean
26
19
  * ```
27
20
  *
28
21
  * @description
29
- * Functional equivalent of the [Less than (<)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Less_than) operator. Tests if a value is less than (`<`) another value.
22
+ * Comparison operator. Tests if a value is less than (`<`) another value.
30
23
  *
31
24
  * ```javascript [playground]
32
- * console.log(lt(1, 3)) // true
33
- * console.log(lt(3, 3)) // false
34
- * console.log(lt(4, 3)) // false
25
+ * console.log(lt(1, 3))
26
+ * console.log(lt(3, 3))
27
+ * console.log(lt(4, 3))
35
28
  * ```
36
29
  *
37
- * If either of the two values are resolver functions, `lt` returns a function that resolves the value(s) to compare.
30
+ * If either of the two values are resolver functions, `lt` returns a function that resolves the values to compare.
38
31
  *
39
32
  * ```javascript [playground]
40
33
  * const identity = value => value
41
34
  *
42
35
  * const isLessThan3 = lt(identity, 3)
43
36
  *
44
- * console.log(isLessThan3(1)) // true
45
- * console.log(isLessThan3(3)) // false
46
- * console.log(isLessThan3(5)) // false
37
+ * console.log(isLessThan3(1))
38
+ * console.log(isLessThan3(3))
39
+ * console.log(isLessThan3(5))
47
40
  * ```
48
41
  *
49
42
  * If either of the resolver functions is asynchronous, `lt` returns an asynchronous function.
@@ -53,9 +46,9 @@ const lessThan = require('./_internal/lessThan')
53
46
  *
54
47
  * const asyncIsLessThan3 = lt(asyncIdentity, 3)
55
48
  *
56
- * asyncIsLessThan3(1).then(console.log) // true
57
- * asyncIsLessThan3(3).then(console.log) // false
58
- * asyncIsLessThan3(5).then(console.log) // false
49
+ * asyncIsLessThan3(1).then(console.log)
50
+ * asyncIsLessThan3(3).then(console.log)
51
+ * asyncIsLessThan3(5).then(console.log)
59
52
  * ```
60
53
  *
61
54
  * `lt` supports a lazy interface for composability.
@@ -63,15 +56,24 @@ const lessThan = require('./_internal/lessThan')
63
56
  * ```javascript [playground]
64
57
  * pipe({ value: 1 }, [
65
58
  * lt(0, get('value')),
66
- * console.log, // true
59
+ * console.log,
67
60
  * ])
68
61
  * ```
69
62
  *
70
- * Any promises passed in data argument position are resolved for their values before further execution.
63
+ * Any promises in `arguments` are resolved for their values before further execution for the eager interface only.
71
64
  *
72
65
  * ```javascript [playground]
73
- * lt(Promise.resolve({ a: 1, b: 2 }), get('a'), get('b')).then(console.log) // true
66
+ * lt(Promise.resolve({ a: 1, b: 2 }), get('a'), get('b')).then(console.log)
74
67
  * ```
68
+ *
69
+ * See also:
70
+ * * [and](/docs/and)
71
+ * * [eq](/docs/eq)
72
+ * * [gt](/docs/lt)
73
+ * * [gte](/docs/gte)
74
+ * * [lte](/docs/lte)
75
+ * * [thunkify](/docs/thunkify)
76
+ *
75
77
  */
76
78
  const lt = ComparisonOperator(lessThan)
77
79
 
package/lte.js CHANGED
@@ -6,44 +6,37 @@ const lessThanOrEqual = require('./_internal/lessThanOrEqual')
6
6
  *
7
7
  * @synopsis
8
8
  * ```coffeescript [specscript]
9
- * args Array<any>
10
- * argsOrPromises Array<Promise|any>
11
- *
12
- * type SyncOrAsyncResolver = (...args)=>Promise|any
13
- *
14
- * leftValue Promise|any
15
- * rightValue Promise|any
16
- * leftResolver SyncOrAsyncResolver
17
- * rightResolver SyncOrAsyncResolver
18
- *
19
- * lte(leftValue, rightValue) -> Promise|boolean
20
- * lte(...argsOrPromises, leftResolver, rightValue) -> Promise|boolean
21
- * lte(...argsOrPromises, leftValue, rightResolver) -> Promise|boolean
22
- * lte(...argsOrPromises, leftResolver, rightResolver) -> Promise|boolean
23
- * lte(leftResolver, rightValue)(...args) -> Promise|boolean
24
- * lte(leftValue, rightResolver)(...args) -> Promise|boolean
25
- * lte(leftResolver, rightResolver)(...args) -> Promise|boolean
9
+ * type SyncOrAsyncResolver = (...arguments)=>Promise|any
10
+ *
11
+ * lte(leftValue Promise|any, rightValue Promise|any) -> Promise|boolean
12
+ * lte(...arguments, leftResolver SyncOrAsyncResolver, rightValue Promise|any) -> Promise|boolean
13
+ * lte(...arguments, leftValue Promise|any, rightResolver SyncOrAsyncResolver) -> Promise|boolean
14
+ * lte(...arguments, leftResolver SyncOrAsyncResolver, rightResolver SyncOrAsyncResolver) -> Promise|boolean
15
+ *
16
+ * lte(leftResolver SyncOrAsyncResolver, rightValue Promise|any)(...arguments) -> Promise|boolean
17
+ * lte(leftValue Promise|any, rightResolver SyncOrAsyncResolver)(...arguments) -> Promise|boolean
18
+ * lte(leftResolver SyncOrAsyncResolver, rightResolver SyncOrAsyncResolver)(...arguments) -> Promise|boolean
26
19
  * ```
27
20
  *
28
21
  * @description
29
- * Functional equivalent of the [Less than or equal (>=)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Less_than_or_equal) operator. Tests if a value is less than or equal (`<=`) to another value.
22
+ * Comparison operator. Tests if a value is less than or equal (`<=`) to another value.
30
23
  *
31
24
  * ```javascript [playground]
32
- * console.log(lte(1, 3)) // true
33
- * console.log(lte(3, 3)) // true
34
- * console.log(lte(4, 3)) // false
25
+ * console.log(lte(1, 3))
26
+ * console.log(lte(3, 3))
27
+ * console.log(lte(4, 3))
35
28
  * ```
36
29
  *
37
- * If either of the two values are resolver functions, `lte` returns a function that resolves the value(s) to compare.
30
+ * If either of the two values are resolver functions, `lte` returns a function that resolves the values to compare.
38
31
  *
39
32
  * ```javascript [playground]
40
33
  * const identity = value => value
41
34
  *
42
35
  * const isLessThanOrEqualTo3 = lte(identity, 3)
43
36
  *
44
- * console.log(isLessThanOrEqualTo3(1)) // true
45
- * console.log(isLessThanOrEqualTo3(3)) // true
46
- * console.log(isLessThanOrEqualTo3(5)) // false
37
+ * console.log(isLessThanOrEqualTo3(1))
38
+ * console.log(isLessThanOrEqualTo3(3))
39
+ * console.log(isLessThanOrEqualTo3(5))
47
40
  * ```
48
41
  *
49
42
  * If either of the two resolver functions is asynchronous, `lte` returns an asynchronous function.
@@ -53,9 +46,9 @@ const lessThanOrEqual = require('./_internal/lessThanOrEqual')
53
46
  *
54
47
  * const asyncIsLessThanOrEqualTo3 = lte(asyncIdentity, 3)
55
48
  *
56
- * asyncIsLessThanOrEqualTo3(1).then(console.log) // true
57
- * asyncIsLessThanOrEqualTo3(3).then(console.log) // true
58
- * asyncIsLessThanOrEqualTo3(5).then(console.log) // false
49
+ * asyncIsLessThanOrEqualTo3(1).then(console.log)
50
+ * asyncIsLessThanOrEqualTo3(3).then(console.log)
51
+ * asyncIsLessThanOrEqualTo3(5).then(console.log)
59
52
  * ```
60
53
  *
61
54
  * `lte` supports a lazy interface for composability.
@@ -63,14 +56,14 @@ const lessThanOrEqual = require('./_internal/lessThanOrEqual')
63
56
  * ```javascript [playground]
64
57
  * pipe({ value: 1 }, [
65
58
  * lte(1, get('value')),
66
- * console.log, // true
59
+ * console.log,
67
60
  * ])
68
61
  * ```
69
62
  *
70
- * Any promises passed in data argument position are resolved for their values before further execution.
63
+ * Any promises in `arguments` are resolved for their values before further execution for the eager interface only.
71
64
  *
72
65
  * ```javascript [playground]
73
- * lte(Promise.resolve({ a: 1, b: 1 }), get('a'), get('b')).then(console.log) // true
66
+ * lte(Promise.resolve({ a: 1, b: 1 }), get('a'), get('b')).then(console.log)
74
67
  * ```
75
68
  *
76
69
  * See also:
package/map.js CHANGED
@@ -107,7 +107,20 @@ const _map = function (value, f) {
107
107
  * ```
108
108
  *
109
109
  * @description
110
- * Applies a mapper function to each item of a functor, returning a mapped functor of the same type with the mapped items. The order of the elements is maintained.
110
+ * Applies a mapper function to each item of a functor, returning a mapped functor of the same type with the mapped items. The order of the items of the functor is preserved.
111
+ *
112
+ * ```javascript [playground]
113
+ * const square = number => number ** 2
114
+ *
115
+ * const array = [1, 2, 3, 4, 5]
116
+ * const object = { a: 1, b: 2, c: 3 }
117
+ *
118
+ * const mappedArray = map(array, square)
119
+ * const mappedObject = map(object, square)
120
+ *
121
+ * console.log(mappedArray)
122
+ * console.log(mappedObject)
123
+ * ```
111
124
  *
112
125
  * The following data types are considered to be functors:
113
126
  * * `array`
@@ -160,36 +173,23 @@ const _map = function (value, f) {
160
173
  * mapper(item any, key string, functor Object) -> mappedItem Promise|any
161
174
  * ```
162
175
  *
163
- * ```javascript [playground]
164
- * const square = number => number ** 2
165
- *
166
- * const array = [1, 2, 3, 4, 5]
167
- * const object = { a: 1, b: 2, c: 3 }
168
- *
169
- * const mappedArray = map(array, square)
170
- * const mappedObject = map(object, square)
171
- *
172
- * console.log(mappedArray)
173
- * console.log(mappedObject)
174
- * ```
175
- *
176
176
  * If the functor is an object with a `.map` method, the mapper function signature is defined externally.
177
177
  *
178
- * If the mapper function is asynchronous, it is executed concurrently.
179
- *
180
178
  * If the functor is a generator, the mapper function must be synchronous.
181
179
  *
180
+ * If the mapper function is asynchronous, it is executed concurrently.
181
+ *
182
182
  * ```javascript [playground]
183
183
  * const asyncSquare = async number => number ** 2
184
184
  *
185
185
  * const array = [1, 2, 3, 4, 5]
186
186
  *
187
- * const promise = map(array, asyncSquare)
187
+ * const result = await map(array, asyncSquare)
188
188
  *
189
- * promise.then(console.log)
189
+ * console.log(result)
190
190
  * ```
191
191
  *
192
- * `map` applies the mapper function to just the values of objects and maps.
192
+ * `map` iterates over just the values of objects and maps.
193
193
  *
194
194
  * ```javascript [playground]
195
195
  * const square = number => number ** 2
@@ -204,7 +204,7 @@ const _map = function (value, f) {
204
204
  * console.log(mappedMap)
205
205
  * ```
206
206
  *
207
- * `map` maps each value of a generator, creating a new generator with mapped elements.
207
+ * `map` maps each value of a generator, creating a new generator with mapped items.
208
208
  *
209
209
  * ```javascript [playground]
210
210
  * const capitalize = string => string.toUpperCase()
@@ -298,6 +298,19 @@ const _mapEntries = (value, f) => {
298
298
  * @description
299
299
  * [map](/docs/map) that applies the mapper function to the entries of a functor as opposed to the values.
300
300
  *
301
+ * ```javascript [playground]
302
+ * const upperCaseKeysAndSquareValues =
303
+ * map.entries(([key, value]) => [key.toUpperCase(), value ** 2])
304
+ *
305
+ * const object = { a: 1, b: 2, c: 3 }
306
+ *
307
+ * console.log(upperCaseKeysAndSquareValues(object))
308
+ *
309
+ * const m = new Map([['a', 1], ['b', 2], ['c', 3]])
310
+ *
311
+ * console.log(upperCaseKeysAndSquareValues(m))
312
+ * ```
313
+ *
301
314
  * The following data types are considered to be functors with entries:
302
315
  * * `map`
303
316
  * * `object`
@@ -316,19 +329,6 @@ const _mapEntries = (value, f) => {
316
329
  * mappedEntry Promise|[mappedKey string, mappedValue any]
317
330
  * ```
318
331
  *
319
- * ```javascript [playground]
320
- * const upperCaseKeysAndSquareValues =
321
- * map.entries(([key, value]) => [key.toUpperCase(), value ** 2])
322
- *
323
- * const object = { a: 1, b: 2, c: 3 }
324
- *
325
- * console.log(upperCaseKeysAndSquareValues(object))
326
- *
327
- * const m = new Map([['a', 1], ['b', 2], ['c', 3]])
328
- *
329
- * console.log(upperCaseKeysAndSquareValues(m))
330
- * ```
331
- *
332
332
  * If the functor with entries is a promise, it is resolved for its value before further execution for the eager interface only.
333
333
  *
334
334
  * ```javascript [playground]
@@ -373,7 +373,7 @@ map.entries = function mapEntries(arg0, arg1) {
373
373
  * value any,
374
374
  * indexOrKey number|string|any,
375
375
  * f Functor
376
- * )=>(mappedElement Promise|any)
376
+ * )=>(mappedItem Promise|any)
377
377
  *
378
378
  * _mapSeries(f Functor, f SyncOrAsyncMapper) -> result Promise|Functor
379
379
  * ```
@@ -421,7 +421,7 @@ const _mapSeries = function (functor, f) {
421
421
  * value any,
422
422
  * indexOrKey number|string|any,
423
423
  * functor Functor,
424
- * )=>(mappedElement Promise|any)
424
+ * )=>(mappedItem Promise|any)
425
425
  *
426
426
  * map.series(
427
427
  * functor Promise|Functor,
@@ -552,19 +552,15 @@ const _mapPool = function (f, concurrency, mapper) {
552
552
  * return value
553
553
  * }
554
554
  *
555
- * map.pool(2, pipe([
556
- * delayedIdentity,
557
- * console.log,
558
- * ]))(ids)
555
+ * map.pool(ids, 2, pipe(delayedIdentity, console.log))
559
556
  * ```
560
557
  *
561
- * Any promises passed in data argument position are resolved for their values before further execution.
558
+ * If the functor is a promise, it is resolved for its value before further execution for the eager interface only.
562
559
  *
563
560
  * ```javascript [playground]
564
561
  * const asyncSquare = async n => n ** 2
565
562
  *
566
563
  * map.pool(Promise.resolve([1, 2, 3, 4, 5]), 5, asyncSquare).then(console.log)
567
- * // [1, 4, 9, 16, 25]
568
564
  * ```
569
565
  *
570
566
  * See also:
package/not.js CHANGED
@@ -19,36 +19,31 @@ const _not = function (args, predicate) {
19
19
  *
20
20
  * @synopsis
21
21
  * ```coffeescript [specscript]
22
- * args Array<any>
23
- * argsOrPromises Array<Promise|any>
22
+ * type SyncOrAsyncPredicate = (...arguments)=>Promise|boolean
24
23
  *
25
- * type SyncOrAsyncPredicate = (...args)=>Promise|boolean
26
- *
27
- * predicate SyncOrAsyncPredicate
28
- *
29
- * not(value Promise|boolean|any) -> negated Promise|boolean
30
- * not(...argsOrPromises, predicate) -> negated Promise|boolean
31
- * not(predicate)(...args) -> negated Promise|boolean
24
+ * not(value Promise|boolean|any) -> negatedResult Promise|boolean
25
+ * not(...arguments, predicate SyncOrAsyncPredicate) -> negatedResult Promise|boolean
26
+ * not(predicate SyncOrAsyncPredicate)(...arguments) -> negatedResult Promise|boolean
32
27
  * ```
33
28
  *
34
29
  * @description
35
- * Function equivalent to the [Logical NOT (`!`)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_NOT) operator. Negates a value.
30
+ * Logical operator. Negates a predicate or value.
36
31
  *
37
32
  * ```javascript [playground]
38
- * const myObj = { a: 1 }
33
+ * const object = { a: 1 }
39
34
  *
40
- * console.log(not('a' in myObj)) // false
41
- * console.log(not('b' in myObj)) // true
35
+ * console.log(not('a' in object))
36
+ * console.log(not('b' in object))
42
37
  * ```
43
38
  *
44
- * If provided a predicate function, `not` returns a logically inverted predicate that returns true everywhere the original predicate would have returned false.
39
+ * If provided a predicate function, `not` returns a logically inverted predicate.
45
40
  *
46
41
  * ```javascript [playground]
47
42
  * const isOdd = number => number % 2 == 1
48
43
  *
49
44
  * const isNotOdd = not(isOdd)
50
45
  *
51
- * console.log(isNotOdd(3)) // false
46
+ * console.log(isNotOdd(3))
52
47
  * ```
53
48
  *
54
49
  * `not` negates the resolved value of a promise.
@@ -56,10 +51,10 @@ const _not = function (args, predicate) {
56
51
  * ```javascript [playground]
57
52
  * const promise = Promise.resolve(false)
58
53
  *
59
- * not(promise).then(console.log) // true
54
+ * not(promise).then(console.log)
60
55
  * ```
61
56
  *
62
- * Any promises passed in data argument position are resolved for their values before further execution.
57
+ * Any promises in `arguments` are resolved for their values before further execution for the eager interface only.
63
58
  *
64
59
  * ```javascript [playground]
65
60
  * const isOdd = number => number % 2 == 1
package/or.js CHANGED
@@ -97,37 +97,28 @@ const areAnyPredicatesTruthy = function (args, predicates) {
97
97
  *
98
98
  * @synopsis
99
99
  * ```coffeescript [specscript]
100
- * args Array<any>
101
- * argsOrPromises Array<Promise|any>
100
+ * type SyncOrAsyncPredicate = (...arguments)=>Promise|boolean|any
102
101
  *
103
- * type SyncOrAsyncPredicate = (...args)=>Promise|boolean|any
104
- *
105
- * predicatesOrValues Array<SyncOrAsyncPredicate|boolean|any>
106
- *
107
- * or(values Array<boolean|any>) -> result boolean
108
- * or(...argsOrPromises, predicatesOrValues) -> Promise|boolean
109
- * or(predicatesOrValues)(...args) -> Promise|boolean
102
+ * or(values Array<boolean|any>) -> testResult boolean
103
+ * or(...arguments, predicatesOrValues Array<SyncOrAsyncPredicate|boolean|any>) -> testResult Promise|boolean
104
+ * or(predicatesOrValues Array<SyncOrAsyncPredicate|boolean|any>)(...arguments) -> testResult Promise|boolean
110
105
  * ```
111
106
  *
112
107
  * @description
113
- * Function equivalent to the [Logical OR](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_OR) operator. Tests arrays of predicate functions, promises, values, or a mix thereof.
114
- *
115
- * If provided an array of boolean values, `or` returns true if any boolean values are truthy.
108
+ * Logical operator. Tests an array of predicate functions, promises, or values, returning true if any predicate tests true or any value is truthy.
116
109
  *
117
110
  * ```javascript [playground]
118
- * const oneIsLessThanZero = 1 < 0
119
- * const oneIsGreaterThanTwo = 1 > 2
120
- * const threeIsNotEqualToThree = 3 !== 3
121
- *
122
- * const condition = or([
123
- * oneIsLessThanZero,
124
- * oneIsGreaterThanTwo,
125
- * threeIsNotEqualToThree
111
+ * const isOddOrGreaterThan3 = or([
112
+ * n => n % 2 == 1,
113
+ * n => n > 3,
126
114
  * ])
127
- * console.log(condition) // false
115
+ *
116
+ * console.log(isOddOrGreaterThan3(2))
117
+ * console.log(isOddOrGreaterThan3(3))
118
+ * console.log(isOddOrGreaterThan3(6))
128
119
  * ```
129
120
  *
130
- * If any predicate functions are provided in the array, `or` returns an aggregate predicate function that returns true for a given set of arguments if any provided predicate functions test true. If any provided predicate functions are asynchronous, the aggregate predicate function becomes asynchronous.
121
+ * If the array contains predicate functions, `or` returns an aggregate predicate function that returns true if some predicate function test true. If any predicate function is asynchronous, the aggregate predicate function is asynchronous.
131
122
  *
132
123
  * ```javascript [playground]
133
124
  * const isOdd = number => number % 2 == 1
@@ -141,17 +132,34 @@ const areAnyPredicatesTruthy = function (args, predicates) {
141
132
  * asyncIsGreaterThan3,
142
133
  * ])
143
134
  *
144
- * const condition = await aggregatePredicate(2)
145
- * console.log(condition) // false
135
+ * const booleanResult = await aggregatePredicate(2)
136
+ *
137
+ * console.log(booleanResult)
138
+ * ```
139
+ *
140
+ * If the array contains only values, `or` returns a boolean value.
141
+ *
142
+ * ```javascript [playground]
143
+ * const oneIsLessThanZero = 1 < 0
144
+ * const oneIsGreaterThanTwo = 1 > 2
145
+ * const threeIsNotEqualToThree = 3 !== 3
146
+ *
147
+ * const booleanResult = or([
148
+ * oneIsLessThanZero,
149
+ * oneIsGreaterThanTwo,
150
+ * threeIsNotEqualToThree
151
+ * ])
152
+ *
153
+ * console.log(booleanResult)
146
154
  * ```
147
155
  *
148
- * Any promises passed in data argument position are resolved for their values before further execution.
156
+ * Any promises in the array are resolved for their values before further execution.
149
157
  *
150
158
  * ```javascript [playground]
151
159
  * or(Promise.resolve('aaa'), [
152
160
  * s => s.startsWith('b'),
153
161
  * s => s.endsWith('a'),
154
- * ]).then(console.log) // true
162
+ * ]).then(console.log)
155
163
  * ```
156
164
  *
157
165
  * See also:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rubico",
3
- "version": "2.10.0",
3
+ "version": "2.12.1",
4
4
  "description": "[a]synchronous functional programming",
5
5
  "author": "Richard Tong",
6
6
  "license": "CFOSS",