ramda-adjunct 5.0.0 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (406) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +1 -1
  3. package/dist/RA.node.js +10444 -452
  4. package/dist/RA.node.min.js +1 -1
  5. package/dist/RA.web.js +10444 -452
  6. package/dist/RA.web.min.js +1 -1
  7. package/dist/RA.web.standalone.js +18665 -447
  8. package/dist/RA.web.standalone.min.js +1 -1
  9. package/dist/package.json +1 -0
  10. package/es/copyKeys.js +1 -1
  11. package/es/dispatch.js +5 -5
  12. package/es/fantasy-land/Identity.js +3 -3
  13. package/es/fantasy-land/traits.js +1 -1
  14. package/es/flattenDepth.js +5 -5
  15. package/es/internal/ponyfills/Array.from.js +5 -5
  16. package/es/internal/ponyfills/Promise.allSettled.js +5 -5
  17. package/es/internal/ponyfills/Promise.any.js +15 -15
  18. package/es/lastP.js +5 -5
  19. package/es/reduceP.js +4 -4
  20. package/es/reduceRightP.js +4 -4
  21. package/es/renameKey.js +1 -1
  22. package/es/sortByProps.js +5 -5
  23. package/lib/allEqual.js +1 -1
  24. package/lib/allIdentical.js +1 -1
  25. package/lib/allSettledP.js +1 -1
  26. package/lib/allUnique.js +1 -1
  27. package/lib/anyP.js +1 -1
  28. package/lib/argsPass.js +1 -1
  29. package/lib/async.js +1 -1
  30. package/lib/cata.js +1 -1
  31. package/lib/compact.js +1 -1
  32. package/lib/concatAll.js +1 -1
  33. package/lib/copyKeys.js +2 -2
  34. package/lib/curryRight.js +1 -1
  35. package/lib/delayP.js +1 -1
  36. package/lib/dispatch.js +6 -6
  37. package/lib/ensureArray.js +1 -1
  38. package/lib/escapeRegExp.js +1 -1
  39. package/lib/fantasy-land/Identity.js +3 -3
  40. package/lib/fantasy-land/traits.js +2 -2
  41. package/lib/flattenDepth.js +6 -6
  42. package/lib/flattenProp.js +1 -1
  43. package/lib/fnull.js +1 -1
  44. package/lib/index.js +1 -1
  45. package/lib/internal/ap.js +1 -1
  46. package/lib/internal/isCoercible.js +1 -1
  47. package/lib/internal/makeFlat.js +1 -1
  48. package/lib/internal/ponyfills/Array.from.js +6 -6
  49. package/lib/internal/ponyfills/Math.trunc.js +1 -1
  50. package/lib/internal/ponyfills/Number.isFinite.js +1 -1
  51. package/lib/internal/ponyfills/Number.isInteger.js +1 -1
  52. package/lib/internal/ponyfills/Number.isNaN.js +1 -1
  53. package/lib/internal/ponyfills/Number.isSafeInteger.js +1 -1
  54. package/lib/internal/ponyfills/Promise.allSettled.js +6 -6
  55. package/lib/internal/ponyfills/Promise.any.js +16 -16
  56. package/lib/internal/ponyfills/String.padEnd.js +1 -1
  57. package/lib/internal/ponyfills/String.padStart.js +1 -1
  58. package/lib/internal/ponyfills/String.repeat.js +1 -1
  59. package/lib/internal/ponyfills/String.replaceAll.js +1 -1
  60. package/lib/invoke.js +1 -1
  61. package/lib/invokeArgs.js +1 -1
  62. package/lib/isArray.js +1 -1
  63. package/lib/isArrayLike.js +1 -1
  64. package/lib/isBlank.js +1 -1
  65. package/lib/isEmptyArray.js +1 -1
  66. package/lib/isEven.js +1 -1
  67. package/lib/isFalsy.js +1 -1
  68. package/lib/isFinite.js +1 -1
  69. package/lib/isFloat.js +1 -1
  70. package/lib/isFunction.js +1 -1
  71. package/lib/isIndexed.js +1 -1
  72. package/lib/isInteger.js +1 -1
  73. package/lib/isInteger32.js +1 -1
  74. package/lib/isIterable.js +1 -1
  75. package/lib/isNaN.js +1 -1
  76. package/lib/isNaturalNumber.js +1 -1
  77. package/lib/isNegative.js +1 -1
  78. package/lib/isNonEmptyArray.js +1 -1
  79. package/lib/isNonEmptyString.js +1 -1
  80. package/lib/isNonNegative.js +1 -1
  81. package/lib/isNonPositive.js +1 -1
  82. package/lib/isNotArray.js +1 -1
  83. package/lib/isNotArrayLike.js +1 -1
  84. package/lib/isNotAsyncFunction.js +1 -1
  85. package/lib/isNotBoolean.js +1 -1
  86. package/lib/isNotDate.js +1 -1
  87. package/lib/isNotFinite.js +1 -1
  88. package/lib/isNotFloat.js +1 -1
  89. package/lib/isNotFunction.js +1 -1
  90. package/lib/isNotGeneratorFunction.js +1 -1
  91. package/lib/isNotInteger.js +1 -1
  92. package/lib/isNotMap.js +1 -1
  93. package/lib/isNotNaN.js +1 -1
  94. package/lib/isNotNilOrEmpty.js +1 -1
  95. package/lib/isNotNull.js +1 -1
  96. package/lib/isNotNumber.js +1 -1
  97. package/lib/isNotObj.js +1 -1
  98. package/lib/isNotObjLike.js +1 -1
  99. package/lib/isNotPair.js +1 -1
  100. package/lib/isNotPlainObj.js +1 -1
  101. package/lib/isNotPrimitive.js +1 -1
  102. package/lib/isNotRegExp.js +1 -1
  103. package/lib/isNotSet.js +1 -1
  104. package/lib/isNotString.js +1 -1
  105. package/lib/isNotUndefined.js +1 -1
  106. package/lib/isNotValidDate.js +1 -1
  107. package/lib/isNotValidNumber.js +1 -1
  108. package/lib/isObj.js +1 -1
  109. package/lib/isObjLike.js +1 -1
  110. package/lib/isOdd.js +1 -1
  111. package/lib/isPair.js +1 -1
  112. package/lib/isPlainObj.js +1 -1
  113. package/lib/isPositive.js +1 -1
  114. package/lib/isPrimitive.js +1 -1
  115. package/lib/isPromise.js +1 -1
  116. package/lib/isPrototypeOf.js +1 -1
  117. package/lib/isSafeInteger.js +1 -1
  118. package/lib/isSentinelValue.js +1 -1
  119. package/lib/isSparseArray.js +1 -1
  120. package/lib/isThenable.js +1 -1
  121. package/lib/isUinteger32.js +1 -1
  122. package/lib/isUndefined.js +1 -1
  123. package/lib/isValidDate.js +1 -1
  124. package/lib/isValidNumber.js +1 -1
  125. package/lib/lastP.js +6 -6
  126. package/lib/lengthEq.js +1 -1
  127. package/lib/lengthGt.js +1 -1
  128. package/lib/lengthGte.js +1 -1
  129. package/lib/lengthLt.js +1 -1
  130. package/lib/lengthLte.js +1 -1
  131. package/lib/lengthNotEq.js +1 -1
  132. package/lib/lensNotEq.js +1 -1
  133. package/lib/lensNotSatisfy.js +1 -1
  134. package/lib/lensSatisfies.js +1 -1
  135. package/lib/lensTraverse.js +1 -1
  136. package/lib/liftF.js +1 -1
  137. package/lib/liftFN.js +1 -1
  138. package/lib/mergePaths.js +1 -1
  139. package/lib/mergeProp.js +1 -1
  140. package/lib/noneP.js +1 -1
  141. package/lib/noop.js +1 -1
  142. package/lib/notAllUnique.js +1 -1
  143. package/lib/padCharsEnd.js +1 -1
  144. package/lib/padCharsStart.js +1 -1
  145. package/lib/padEnd.js +1 -1
  146. package/lib/padStart.js +1 -1
  147. package/lib/rangeStep.js +1 -1
  148. package/lib/reduceP.js +5 -5
  149. package/lib/reduceRightP.js +5 -5
  150. package/lib/renameKey.js +2 -2
  151. package/lib/renameKeyWith.js +1 -1
  152. package/lib/renameKeys.js +1 -1
  153. package/lib/repeatStr.js +1 -1
  154. package/lib/replaceAll.js +1 -1
  155. package/lib/sign.js +1 -1
  156. package/lib/sortByProp.js +1 -1
  157. package/lib/sortByProps.js +5 -5
  158. package/lib/spreadProp.js +1 -1
  159. package/lib/toArray.js +1 -1
  160. package/lib/toNumber.js +1 -1
  161. package/lib/trimCharsEnd.js +1 -1
  162. package/lib/trimCharsStart.js +1 -1
  163. package/lib/trimEnd.js +1 -1
  164. package/lib/trimStart.js +1 -1
  165. package/lib/trunc.js +1 -1
  166. package/lib/unzipObjWith.js +1 -1
  167. package/package.json +22 -19
  168. package/babel.config.cjs +0 -56
  169. package/src/Y.js +0 -32
  170. package/src/allEqual.js +0 -28
  171. package/src/allEqualTo.js +0 -25
  172. package/src/allIdentical.js +0 -26
  173. package/src/allIdenticalTo.js +0 -25
  174. package/src/allP.js +0 -27
  175. package/src/allSettledP.js +0 -34
  176. package/src/allUnique.js +0 -25
  177. package/src/anyP.js +0 -33
  178. package/src/appendFlipped.js +0 -24
  179. package/src/argsPass.js +0 -40
  180. package/src/async.js +0 -60
  181. package/src/cata.js +0 -86
  182. package/src/catchP.js +0 -25
  183. package/src/ceil.js +0 -28
  184. package/src/compact.js +0 -23
  185. package/src/concatAll.js +0 -35
  186. package/src/concatRight.js +0 -30
  187. package/src/copyKeys.js +0 -31
  188. package/src/curryRight.js +0 -26
  189. package/src/curryRightN.js +0 -29
  190. package/src/defaultWhen.js +0 -26
  191. package/src/delayP.js +0 -45
  192. package/src/dispatch.js +0 -74
  193. package/src/divideNum.js +0 -20
  194. package/src/dropArgs.js +0 -23
  195. package/src/ensureArray.js +0 -24
  196. package/src/escapeRegExp.js +0 -22
  197. package/src/fantasy-land/Identity.js +0 -270
  198. package/src/fantasy-land/mapping.js +0 -20
  199. package/src/fantasy-land/traits.js +0 -57
  200. package/src/fantasy-land/util.js +0 -23
  201. package/src/filterIndexed.js +0 -28
  202. package/src/findOr.js +0 -30
  203. package/src/flattenDepth.js +0 -39
  204. package/src/flattenPath.js +0 -28
  205. package/src/flattenProp.js +0 -28
  206. package/src/floor.js +0 -27
  207. package/src/fnull.js +0 -38
  208. package/src/inRange.js +0 -34
  209. package/src/included.js +0 -28
  210. package/src/index.js +0 -241
  211. package/src/internal/ap.js +0 -30
  212. package/src/internal/compareLength.js +0 -7
  213. package/src/internal/isCoercible.js +0 -12
  214. package/src/internal/isOfTypeObject.js +0 -3
  215. package/src/internal/makeFlat.js +0 -42
  216. package/src/internal/ponyfills/Array.from.js +0 -34
  217. package/src/internal/ponyfills/Math.sign.js +0 -3
  218. package/src/internal/ponyfills/Math.trunc.js +0 -14
  219. package/src/internal/ponyfills/Number.MAX_SAFE_INTEGER.js +0 -3
  220. package/src/internal/ponyfills/Number.MIN_SAFE_INTEGER.js +0 -3
  221. package/src/internal/ponyfills/Number.isFinite.js +0 -8
  222. package/src/internal/ponyfills/Number.isInteger.js +0 -10
  223. package/src/internal/ponyfills/Number.isNaN.js +0 -8
  224. package/src/internal/ponyfills/Number.isSafeInteger.js +0 -11
  225. package/src/internal/ponyfills/Promise.allSettled.js +0 -18
  226. package/src/internal/ponyfills/Promise.any.js +0 -29
  227. package/src/internal/ponyfills/String.padEnd.js +0 -25
  228. package/src/internal/ponyfills/String.padStart.js +0 -27
  229. package/src/internal/ponyfills/String.repeat.js +0 -49
  230. package/src/internal/ponyfills/String.replaceAll.js +0 -44
  231. package/src/internal/ponyfills/String.trimEnd.js +0 -5
  232. package/src/internal/ponyfills/String.trimStart.js +0 -5
  233. package/src/invoke.js +0 -22
  234. package/src/invokeArgs.js +0 -36
  235. package/src/isArray.js +0 -27
  236. package/src/isArrayLike.js +0 -79
  237. package/src/isAsyncFunction.js +0 -23
  238. package/src/isBigInt.js +0 -24
  239. package/src/isBlank.js +0 -33
  240. package/src/isBoolean.js +0 -22
  241. package/src/isDate.js +0 -21
  242. package/src/isEmptyArray.js +0 -28
  243. package/src/isEmptyString.js +0 -28
  244. package/src/isError.js +0 -21
  245. package/src/isEven.js +0 -31
  246. package/src/isFalse.js +0 -31
  247. package/src/isFalsy.js +0 -28
  248. package/src/isFinite.js +0 -37
  249. package/src/isFloat.js +0 -36
  250. package/src/isFunction.js +0 -32
  251. package/src/isGeneratorFunction.js +0 -26
  252. package/src/isIndexed.js +0 -24
  253. package/src/isInteger.js +0 -40
  254. package/src/isInteger32.js +0 -28
  255. package/src/isIterable.js +0 -37
  256. package/src/isMap.js +0 -25
  257. package/src/isNaN.js +0 -45
  258. package/src/isNaturalNumber.js +0 -28
  259. package/src/isNegative.js +0 -27
  260. package/src/isNegativeZero.js +0 -23
  261. package/src/isNilOrEmpty.js +0 -26
  262. package/src/isNonEmptyArray.js +0 -28
  263. package/src/isNonEmptyString.js +0 -31
  264. package/src/isNonNegative.js +0 -30
  265. package/src/isNonPositive.js +0 -30
  266. package/src/isNotArray.js +0 -24
  267. package/src/isNotArrayLike.js +0 -26
  268. package/src/isNotAsyncFunction.js +0 -27
  269. package/src/isNotBoolean.js +0 -24
  270. package/src/isNotDate.js +0 -23
  271. package/src/isNotFinite.js +0 -31
  272. package/src/isNotFloat.js +0 -35
  273. package/src/isNotFunction.js +0 -29
  274. package/src/isNotGeneratorFunction.js +0 -27
  275. package/src/isNotInteger.js +0 -36
  276. package/src/isNotMap.js +0 -27
  277. package/src/isNotNaN.js +0 -37
  278. package/src/isNotNil.js +0 -23
  279. package/src/isNotNilOrEmpty.js +0 -28
  280. package/src/isNotNull.js +0 -24
  281. package/src/isNotNumber.js +0 -25
  282. package/src/isNotObj.js +0 -29
  283. package/src/isNotObjLike.js +0 -29
  284. package/src/isNotPair.js +0 -27
  285. package/src/isNotPlainObj.js +0 -35
  286. package/src/isNotPrimitive.js +0 -26
  287. package/src/isNotRegExp.js +0 -24
  288. package/src/isNotSet.js +0 -26
  289. package/src/isNotString.js +0 -23
  290. package/src/isNotUndefined.js +0 -24
  291. package/src/isNotValidDate.js +0 -24
  292. package/src/isNotValidNumber.js +0 -27
  293. package/src/isNull.js +0 -22
  294. package/src/isNumber.js +0 -24
  295. package/src/isObj.js +0 -31
  296. package/src/isObjLike.js +0 -30
  297. package/src/isOdd.js +0 -29
  298. package/src/isPair.js +0 -27
  299. package/src/isPlainObj.js +0 -65
  300. package/src/isPositive.js +0 -26
  301. package/src/isPositiveZero.js +0 -23
  302. package/src/isPrimitive.js +0 -46
  303. package/src/isPromise.js +0 -32
  304. package/src/isPrototypeOf.js +0 -36
  305. package/src/isRegExp.js +0 -22
  306. package/src/isSafeInteger.js +0 -40
  307. package/src/isSentinelValue.js +0 -26
  308. package/src/isSet.js +0 -24
  309. package/src/isSparseArray.js +0 -43
  310. package/src/isString.js +0 -21
  311. package/src/isSymbol.js +0 -29
  312. package/src/isThenable.js +0 -28
  313. package/src/isTrue.js +0 -27
  314. package/src/isTruthy.js +0 -28
  315. package/src/isUinteger32.js +0 -29
  316. package/src/isUndefined.js +0 -24
  317. package/src/isValidDate.js +0 -29
  318. package/src/isValidNumber.js +0 -28
  319. package/src/lastP.js +0 -54
  320. package/src/lengthEq.js +0 -24
  321. package/src/lengthGt.js +0 -24
  322. package/src/lengthGte.js +0 -26
  323. package/src/lengthLt.js +0 -24
  324. package/src/lengthLte.js +0 -25
  325. package/src/lengthNotEq.js +0 -24
  326. package/src/lensEq.js +0 -28
  327. package/src/lensIso.js +0 -51
  328. package/src/lensNotEq.js +0 -28
  329. package/src/lensNotSatisfy.js +0 -30
  330. package/src/lensSatisfies.js +0 -33
  331. package/src/lensTraverse.js +0 -56
  332. package/src/liftF.js +0 -37
  333. package/src/liftFN.js +0 -45
  334. package/src/list.js +0 -20
  335. package/src/mapIndexed.js +0 -27
  336. package/src/mergePath.js +0 -30
  337. package/src/mergePaths.js +0 -29
  338. package/src/mergeProp.js +0 -30
  339. package/src/mergeProps.js +0 -27
  340. package/src/move.js +0 -26
  341. package/src/nand.js +0 -27
  342. package/src/neither.js +0 -38
  343. package/src/noneP.js +0 -35
  344. package/src/nonePass.js +0 -32
  345. package/src/noop.js +0 -21
  346. package/src/nor.js +0 -28
  347. package/src/notAllPass.js +0 -32
  348. package/src/notAllUnique.js +0 -25
  349. package/src/notBoth.js +0 -38
  350. package/src/notEqual.js +0 -31
  351. package/src/omitBy.js +0 -25
  352. package/src/omitIndexes.js +0 -27
  353. package/src/overlaps.js +0 -30
  354. package/src/padCharsEnd.js +0 -37
  355. package/src/padCharsStart.js +0 -35
  356. package/src/padEnd.js +0 -25
  357. package/src/padStart.js +0 -23
  358. package/src/pathNotEq.js +0 -31
  359. package/src/pathOrLazy.js +0 -30
  360. package/src/paths.js +0 -26
  361. package/src/pickIndexes.js +0 -30
  362. package/src/propNotEq.js +0 -30
  363. package/src/rangeStep.js +0 -37
  364. package/src/reduceIndexed.js +0 -31
  365. package/src/reduceP.js +0 -96
  366. package/src/reduceRightP.js +0 -101
  367. package/src/rejectP.js +0 -24
  368. package/src/renameKey.js +0 -33
  369. package/src/renameKeyWith.js +0 -30
  370. package/src/renameKeys.js +0 -40
  371. package/src/renameKeysWith.js +0 -27
  372. package/src/repeatStr.js +0 -30
  373. package/src/replaceAll.js +0 -35
  374. package/src/resolveP.js +0 -28
  375. package/src/round.js +0 -26
  376. package/src/seq.js +0 -38
  377. package/src/sign.js +0 -33
  378. package/src/skipTake.js +0 -33
  379. package/src/sliceFrom.js +0 -23
  380. package/src/sliceTo.js +0 -23
  381. package/src/sortByPaths.js +0 -55
  382. package/src/sortByProp.js +0 -45
  383. package/src/sortByProps.js +0 -31
  384. package/src/spreadPath.js +0 -26
  385. package/src/spreadProp.js +0 -25
  386. package/src/stubArray.js +0 -18
  387. package/src/stubNull.js +0 -19
  388. package/src/stubObj.js +0 -19
  389. package/src/stubString.js +0 -19
  390. package/src/stubUndefined.js +0 -19
  391. package/src/subtractNum.js +0 -20
  392. package/src/thenCatchP.js +0 -27
  393. package/src/toArray.js +0 -32
  394. package/src/toInteger32.js +0 -22
  395. package/src/toNumber.js +0 -24
  396. package/src/toUinteger32.js +0 -26
  397. package/src/trimCharsEnd.js +0 -25
  398. package/src/trimCharsStart.js +0 -25
  399. package/src/trimEnd.js +0 -30
  400. package/src/trimStart.js +0 -29
  401. package/src/trunc.js +0 -33
  402. package/src/unzipObjWith.js +0 -40
  403. package/src/viewOr.js +0 -32
  404. package/src/weave.js +0 -35
  405. package/src/weaveLazy.js +0 -37
  406. package/src/zipObjWith.js +0 -27
@@ -1,30 +0,0 @@
1
- import { concat, flip } from 'ramda';
2
-
3
- /**
4
- * Returns the result of concatenating the given lists or strings.
5
- *
6
- * Note: R.concat expects both arguments to be of the same type, unlike
7
- * the native Array.prototype.concat method.
8
- * It will throw an error if you concat an Array with a non-Array value.
9
- * Dispatches to the concat method of the second argument, if present.
10
- *
11
- * @func concatRight
12
- * @memberOf RA
13
- * @since {@link https://char0n.github.io/ramda-adjunct/1.11.0|v1.11.0}
14
- * @category List
15
- * @sig [a] -> [a] -> [a]
16
- * @sig String -> String -> String
17
- * @param {Array|String} firstList The first list
18
- * @param {Array|String} secondList The second list
19
- * @return {Array|String} A list consisting of the elements of `secondList`
20
- * followed by the elements of `firstList`.
21
- * @see {@link http://ramdajs.com/docs/#concat|R.concat}
22
- * @example
23
- *
24
- * RA.concatRight('ABC', 'DEF'); //=> 'DEFABC'
25
- * RA.concatRight([4, 5, 6], [1, 2, 3]); //=> [1, 2, 3, 4, 5, 6]
26
- * RA.concatRight([], []); //=> []
27
- */
28
- const concatRight = flip(concat);
29
-
30
- export default concatRight;
package/src/copyKeys.js DELETED
@@ -1,31 +0,0 @@
1
- import { curryN } from 'ramda';
2
-
3
- import renameKeys from './renameKeys.js';
4
-
5
- /**
6
- * Creates a new object with the own properties of the provided object, and the
7
- * keys copied according to the keysMap object as `{oldKey: newKey}`.
8
- * When no key from the keysMap is found, then a shallow clone of an object is returned.
9
- *
10
- * Keep in mind that in the case of keys conflict is behaviour undefined and
11
- * the result may vary between various JS engines!
12
- *
13
- * @func copyKeys
14
- * @memberOf RA
15
- * @category Object
16
- * @sig {a: b} -> {a: *} -> {b: *}
17
- * @param {!Object} keysMap
18
- * @param {!Object} obj
19
- * @return {!Object} New object with copied keys
20
- * @see {@link RA.renameKeys|renameKeys}
21
- * @example
22
- *
23
- * copyKeys({ a: 'b' }, { a: true }); //=> { a: true, b: true }
24
- * copyKeys({ a: 'b' }, { a: true, b: false }); //=> { a: true, b: true }
25
- */
26
- const copyKeys = curryN(2, (keysMap, obj) => ({
27
- ...obj,
28
- ...renameKeys(keysMap, obj),
29
- }));
30
-
31
- export default copyKeys;
package/src/curryRight.js DELETED
@@ -1,26 +0,0 @@
1
- import { converge, length, identity } from 'ramda';
2
-
3
- import curryRightN from './curryRightN.js';
4
-
5
- /**
6
- * Returns a curried equivalent of the provided function.
7
- * This function is like curry, except that the provided arguments order is reversed.
8
- *
9
- * @func curryRight
10
- * @memberOf RA
11
- * @since {@link https://char0n.github.io/ramda-adjunct/1.12.0|v1.12.0}
12
- * @category Function
13
- * @sig (* -> a) -> (* -> a)
14
- * @param {Function} fn The function to curry
15
- * @return {Function} A new, curried function
16
- * @see {@link http://ramdajs.com/docs/#curry|R.curry}, {@link RA.curryRightN|curryRightN}
17
- * @example
18
- *
19
- * const concatStrings = (a, b, c) => a + b + c;
20
- * const concatStringsCurried = RA.curryRight(concatStrings);
21
- *
22
- * concatStringCurried('a')('b')('c'); // => 'cba'
23
- */
24
- const curryRight = converge(curryRightN, [length, identity]);
25
-
26
- export default curryRight;
@@ -1,29 +0,0 @@
1
- import { curryN, reverse } from 'ramda';
2
-
3
- /**
4
- * Returns a curried equivalent of the provided function, with the specified arity.
5
- * This function is like curryN, except that the provided arguments order is reversed.
6
- *
7
- * @func curryRightN
8
- * @memberOf RA
9
- * @since {@link https://char0n.github.io/ramda-adjunct/1.12.0|v1.12.0}
10
- * @category Function
11
- * @sig Number -> (* -> a) -> (* -> a)
12
- * @param {number} length The arity for the returned function
13
- * @param {Function} fn The function to curry
14
- * @return {Function} A new, curried function
15
- * @see {@link http://ramdajs.com/docs/#curryN|R.curryN}, {@link RA.curryRight|curryRight}
16
- * @example
17
- *
18
- * const concatStrings = (a, b, c) => a + b + c;
19
- * const concatStringsCurried = RA.curryRightN(3, concatStrings);
20
- *
21
- * concatStringCurried('a')('b')('c'); // => 'cba'
22
- */
23
- const curryRightN = curryN(2, (arity, fn) =>
24
- curryN(arity, function wrapper(...args) {
25
- return fn.apply(this, reverse(args));
26
- })
27
- );
28
-
29
- export default curryRightN;
@@ -1,26 +0,0 @@
1
- import { curry } from 'ramda';
2
-
3
- /**
4
- * Returns the second argument if predicate function returns `true`,
5
- * otherwise the third argument is returned.
6
- *
7
- * @func defaultWhen
8
- * @memberOf RA
9
- * @since {@link https://char0n.github.io/ramda-adjunct/2.2.0|v2.2.0}
10
- * @category Logic
11
- * @sig (a -> Boolean) -> b -> a -> a | b
12
- * @param {!function} predicate The predicate function
13
- * @param {*} defaultVal The default value
14
- * @param {*} val `val` will be returned instead of `defaultVal` if predicate returns false
15
- * @return {*} The `val` if predicate returns `false`, otherwise the default value
16
- * @see {@link http://ramdajs.com/docs/#defaultTo|R.defaultTo}
17
- * @example
18
- *
19
- * RA.defaultWhen(RA.isNull, 1, null); // => 1
20
- * RA.defaultWhen(RA.isNull, 1, 2); // => 2
21
- */
22
- const defaultWhen = curry((predicate, defaultVal, val) =>
23
- predicate(val) ? defaultVal : val
24
- );
25
-
26
- export default defaultWhen;
package/src/delayP.js DELETED
@@ -1,45 +0,0 @@
1
- import { curry, propOr, partial, nth } from 'ramda';
2
-
3
- import isNonNegative from './isNonNegative.js';
4
- import isInteger from './isInteger.js';
5
-
6
- /**
7
- * Creates a promise which resolves/rejects after the specified milliseconds.
8
- *
9
- * @func delayP
10
- * @memberOf RA
11
- * @category Function
12
- * @sig Number -> Promise Undefined
13
- * @sig {timeout: Number, value: a} -> Promise a
14
- * @param {number|Object} milliseconds number of milliseconds or options object
15
- * @return {Promise} A Promise that is resolved/rejected with the given value (if provided) after the specified delay
16
- * @example
17
- *
18
- * RA.delayP(200); //=> Promise(undefined)
19
- * RA.delayP({ timeout: 1000, value: 'hello world' }); //=> Promise('hello world')
20
- * RA.delayP.reject(100); //=> Promise(undefined)
21
- * RA.delayP.reject({ timeout: 100, value: new Error('error') }); //=> Promise(Error('error'))
22
- */
23
-
24
- const makeDelay = curry((settleFnPicker, opts) => {
25
- let timeout;
26
- let value;
27
-
28
- if (isInteger(opts) && isNonNegative(opts)) {
29
- timeout = opts;
30
- } else {
31
- timeout = propOr(0, 'timeout', opts);
32
- value = propOr(value, 'value', opts);
33
- }
34
-
35
- return new Promise((...args) => {
36
- const settleFn = settleFnPicker(args);
37
-
38
- setTimeout(partial(settleFn, [value]), timeout);
39
- });
40
- });
41
-
42
- const delayP = makeDelay(nth(0));
43
- delayP.reject = makeDelay(nth(1));
44
-
45
- export default delayP;
package/src/dispatch.js DELETED
@@ -1,74 +0,0 @@
1
- import {
2
- sort,
3
- comparator,
4
- prop,
5
- pipe,
6
- head,
7
- curryN,
8
- reduce,
9
- reduced,
10
- curry,
11
- ifElse,
12
- } from 'ramda';
13
-
14
- /**
15
- * Can be used as a way to compose multiple invokers together to form polymorphic functions,
16
- * or functions that exhibit different behaviors based on their argument(s).
17
- * Consumes dispatching functions and keep trying to invoke each in turn, until a non-nil value is returned.
18
- *
19
- * Accepts a list of dispatching functions and returns a new function.
20
- * When invoked, this new function is applied to some arguments,
21
- * each dispatching function is applied to those same arguments until one of the
22
- * dispatching functions returns a non-nil value.
23
- *
24
- * @func dispatch
25
- * @memberOf RA
26
- * @since {@link https://char0n.github.io/ramda-adjunct/2.6.0|v2.6.0}
27
- * @category Function
28
- * @sig [((a, b, ...) -> x1), ((a, b, ...) -> x2), ...] -> x1 | x2 | ...
29
- * @param {!Array} functions A list of functions
30
- * @return {*|undefined} Returns the first not-nil value, or undefined if either an empty list is provided or none of the dispatching functions returns a non-nil value
31
- * @see {@link RA.isNotNil}
32
- * @example
33
- *
34
- * // returns first non-nil value
35
- * const stubNil = () => null;
36
- * const stubUndefined = () => undefined;
37
- * const addOne = v => v + 1;
38
- * const addTwo = v => v + 2;
39
- *
40
- * RA.dispatch([stubNil, stubUndefined, addOne, addTwo])(1); //=> 2
41
- *
42
- * // acts as a switch
43
- * const fnSwitch = RA.dispatch([
44
- * R.ifElse(RA.isString, s => `${s}-join`, RA.stubUndefined),
45
- * R.ifElse(RA.isNumber, n => n + 1, RA.stubUndefined),
46
- * R.ifElse(RA.isDate, R.T, RA.stubUndefined),
47
- * ]);
48
- * fnSwitch(1); //=> 2
49
- */
50
- import isNotNil from './isNotNil.js';
51
- import isNonEmptyArray from './isNonEmptyArray.js';
52
- import stubUndefined from './stubUndefined.js';
53
-
54
- const byArity = comparator((a, b) => a.length > b.length);
55
-
56
- const getMaxArity = pipe(sort(byArity), head, prop('length'));
57
-
58
- const iteratorFn = curry((args, accumulator, fn) => {
59
- const result = fn(...args);
60
-
61
- return isNotNil(result) ? reduced(result) : accumulator;
62
- });
63
-
64
- const dispatchImpl = (functions) => {
65
- const arity = getMaxArity(functions);
66
-
67
- return curryN(arity, (...args) =>
68
- reduce(iteratorFn(args), undefined, functions)
69
- );
70
- };
71
-
72
- const dispatch = ifElse(isNonEmptyArray, dispatchImpl, stubUndefined);
73
-
74
- export default dispatch;
package/src/divideNum.js DELETED
@@ -1,20 +0,0 @@
1
- import { divide, flip } from 'ramda';
2
-
3
- /**
4
- * Divides two numbers, where the second number is divided by the first number.
5
- *
6
- * @func divideNum
7
- * @memberOf RA
8
- * @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
9
- * @category Math
10
- * @sig Number -> Number -> Number
11
- * @param {number} divisor the number to divide by
12
- * @param {number} dividend the number to divide
13
- * @return {number} A number representing the quotient of dividing the dividend by the divisor
14
- * @example
15
- *
16
- * RA.divideNum(2, 1); //=> 0.5
17
- */
18
- const divideNum = flip(divide);
19
-
20
- export default divideNum;
package/src/dropArgs.js DELETED
@@ -1,23 +0,0 @@
1
- import { nAry } from 'ramda';
2
-
3
- /**
4
- * Accepts a function with any arity and returns a function with arity of zero.
5
- * The returned function ignores any arguments supplied to it.
6
- *
7
- * @func dropArgs
8
- * @memberOf RA
9
- * @since {@link https://char0n.github.io/ramda-adjunct/2.10.0|v2.10.0}
10
- * @category Logic
11
- * @sig (...a -> b)-> () -> b
12
- * @param {Function} fn The function with any arity
13
- * @return {Function} Returns function with arity of zero
14
- * @see {@link http://ramdajs.com/docs/#nAry|R.nAry}
15
- * @example
16
- *
17
- * const fn = (a = 1, b = 2) => a + b;
18
- *
19
- * RA.dropArgs(fn)('ignore1', 'ignore2'); //=> 3
20
- */
21
- const dropArgs = nAry(0);
22
-
23
- export default dropArgs;
@@ -1,24 +0,0 @@
1
- import { when, of } from 'ramda';
2
-
3
- import isNotArray from './isNotArray.js';
4
-
5
- /**
6
- * Returns a singleton array containing the value provided.
7
- * If value is already an array, it is returned as is.
8
- *
9
- * @func ensureArray
10
- * @memberOf RA
11
- * @since {@link https://char0n.github.io/ramda-adjunct/2.6.0|v2.6.0}
12
- * @category List
13
- * @sig a | [a] -> [a]
14
- * @param {*|Array} val the value ensure as Array
15
- * @return {Array}
16
- * @see {@link http://ramdajs.com/docs/#of|R.of}
17
- * @example
18
- *
19
- * RA.ensureArray(42); //=> [42]
20
- * RA.ensureArray([42]); //=> [42]
21
- */
22
- const ensureArray = when(isNotArray, of(Array));
23
-
24
- export default ensureArray;
@@ -1,22 +0,0 @@
1
- import { when, replace } from 'ramda';
2
-
3
- import isString from './isString.js';
4
-
5
- /**
6
- * Escapes the RegExp special characters.
7
- *
8
- * @func escapeRegExp
9
- * @memberOf RA
10
- * @since {@link https://char0n.github.io/ramda-adjunct/2.21.0|v2.21.0}
11
- * @category String
12
- * @sig String -> String
13
- * @param {string} val the value to escape
14
- * @return {string}
15
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Escaping|MDN Regular Expressions Escaping}
16
- * @example
17
- *
18
- * RA.escapeRegExp('[ramda-adjunct](https://github.com/char0n/ramda-adjunct)'); //=> '\[ramda\-adjunct\]\(https://github\.com/char0n/ramda\-adjunct\)'
19
- */
20
- const escapeRegExp = when(isString, replace(/[.*+?^${}()|[\]\\-]/g, '\\$&'));
21
-
22
- export default escapeRegExp;
@@ -1,270 +0,0 @@
1
- import { empty as emptyR } from 'ramda';
2
-
3
- import * as fl from './mapping.js';
4
- import {
5
- applyTrait,
6
- functorTrait,
7
- setoidTrait,
8
- semigroupTrait,
9
- chainTrait,
10
- ordTrait,
11
- } from './traits.js';
12
-
13
- /**
14
- * The simplest {@link https://github.com/fantasyland/fantasy-land|fantasy-land}
15
- * compatible monad which attaches no information to values.
16
- *
17
- * The Identity type is a very simple type that has no interesting side effects and
18
- * is effectively just a container of some value. So why does it exist ?
19
- * The Identity type is often used as the base monad of a monad
20
- * transformer when no other behaviour is required.
21
- *
22
- * @memberOf RA
23
- * @implements
24
- * {@link https://github.com/fantasyland/fantasy-land#apply|Apply},
25
- * {@link https://github.com/fantasyland/fantasy-land#applicative|Applicative},
26
- * {@link https://github.com/fantasyland/fantasy-land#functor|Functor},
27
- * {@link https://github.com/fantasyland/fantasy-land#setoid|Setoid},
28
- * {@link https://github.com/fantasyland/fantasy-land#semigroup|Semigroup},
29
- * {@link https://github.com/fantasyland/fantasy-land#chain|Chain},
30
- * {@link https://github.com/fantasyland/fantasy-land#monad|Monad},
31
- * {@link https://github.com/fantasyland/fantasy-land#ord|Ord},
32
- * {@link https://github.com/fantasyland/fantasy-land#monoid|Monoid*},
33
- * {@link https://github.com/fantasyland/fantasy-land#contravariant|Contravariant}
34
- * @since {@link https://char0n.github.io/ramda-adjunct/1.8.0|v1.8.0}
35
- */
36
- class Identity {
37
- /**
38
- * Fantasy land {@link https://github.com/fantasyland/fantasy-land#applicative|Applicative} specification.
39
- *
40
- * @static
41
- * @sig of :: Applicative f => a -> f a
42
- * @param {*} value
43
- * @returns {RA.Identity}
44
- * @example
45
- *
46
- * const a = Identity.of(1); //=> Identity(1)
47
- */
48
- static [fl.of](value) {
49
- return new Identity(value);
50
- }
51
-
52
- static of(value) {
53
- return new Identity(value);
54
- }
55
-
56
- /**
57
- * @static
58
- */
59
- static get ['@@type']() {
60
- return 'RA/Identity';
61
- }
62
-
63
- /**
64
- * Private constructor. Use {@link RA.Identity.of|Identity.of} instead.
65
- *
66
- * @param {*} value
67
- * @return {RA.Identity}
68
- */
69
- constructor(value) {
70
- this.value = value;
71
- }
72
-
73
- /**
74
- * Catamorphism for a value.
75
- * @returns {*}
76
- * @example
77
- *
78
- * const a = Identity.of(1);
79
- * a.get(); //=> 1
80
- */
81
- get() {
82
- return this.value;
83
- }
84
-
85
- /**
86
- * Fantasy land {@link https://github.com/fantasyland/fantasy-land#apply|Apply} specification.
87
- *
88
- * @sig ap :: Apply f => f a ~> f (a -> b) -> f b
89
- * @param {RA.Identity} applyWithFn
90
- * @return {RA.Identity}
91
- * @example
92
- *
93
- * const a = Identity.of(1);
94
- * const b = Identity.of(1).map(a => b => a + b);
95
- *
96
- * a.ap(b); //=> Identity(2)
97
- */
98
- [fl.ap](applyWithFn) {
99
- return applyTrait[fl.ap].call(this, applyWithFn);
100
- }
101
-
102
- ap(applyWithFn) {
103
- return this[fl.ap](applyWithFn);
104
- }
105
-
106
- /**
107
- * Fantasy land {@link https://github.com/fantasyland/fantasy-land#functor|Functor} specification.
108
- *
109
- * @sig map :: Functor f => f a ~> (a -> b) -> f b
110
- * @param {Function} fn
111
- * @return {RA.Identity}
112
- * @example
113
- *
114
- * const a = Identity.of(1);
115
- * a.map(a => a + 1); //=> Identity(2)
116
- */
117
- [fl.map](fn) {
118
- return functorTrait[fl.map].call(this, fn);
119
- }
120
-
121
- map(fn) {
122
- return this[fl.map](fn);
123
- }
124
-
125
- /**
126
- * Fantasy land {@link https://github.com/fantasyland/fantasy-land#setoid|Setoid} specification.
127
- *
128
- * @sig equals :: Setoid a => a ~> a -> Boolean
129
- * @param {RA.Identity} setoid
130
- * @return {boolean}
131
- * @example
132
- *
133
- * const a = Identity.of(1);
134
- * const b = Identity.of(1);
135
- * const c = Identity.of(2);
136
- *
137
- * a.equals(b); //=> true
138
- * a.equals(c); //=> false
139
- */
140
- [fl.equals](setoid) {
141
- return setoidTrait[fl.equals].call(this, setoid);
142
- }
143
-
144
- equals(setoid) {
145
- return this[fl.equals](setoid);
146
- }
147
-
148
- /**
149
- * Fantasy land {@link https://github.com/fantasyland/fantasy-land#semigroup|Semigroup} specification.
150
- *
151
- * @sig concat :: Semigroup a => a ~> a -> a
152
- * @param {RA.Identity} semigroup
153
- * @return {RA.Identity}
154
- * @example
155
- *
156
- * const a = Identity.of(1);
157
- * const b = Identity.of(1);
158
- * a.concat(b); //=> 2
159
- *
160
- * const c = Identity.of('c');
161
- * const d = Identity.of('d');
162
- * c.concat(d); //=> 'cd'
163
- *
164
- * const e = Identity.of(['e']);
165
- * const f = Identity.of(['f']);
166
- * e.concat(f); //=> ['e', 'f']
167
- */
168
- [fl.concat](semigroup) {
169
- return semigroupTrait[fl.concat].call(this, semigroup);
170
- }
171
-
172
- concat(semigroup) {
173
- return this[fl.concat](semigroup);
174
- }
175
-
176
- /**
177
- * Fantasy land {@link https://github.com/fantasyland/fantasy-land#chain|Chain} specification.
178
- *
179
- * @sig chain :: Chain m => m a ~> (a -> m b) -> m b
180
- * @param {Function} fn Function returning the value of the same {@link https://github.com/fantasyland/fantasy-land#semigroup|Chain}
181
- * @return {RA.Identity}
182
- * @example
183
- *
184
- * const a = Identity.of(1);
185
- * const fn = val => Identity.of(val + 1);
186
- *
187
- * a.chain(fn).chain(fn); //=> Identity(3)
188
- */
189
- [fl.chain](fn) {
190
- return chainTrait[fl.chain].call(this, fn);
191
- }
192
-
193
- chain(fn) {
194
- return this[fl.chain](fn);
195
- }
196
-
197
- /**
198
- * Fantasy land {@link https://github.com/fantasyland/fantasy-land#ord|Ord} specification.
199
- *
200
- * @sig lte :: Ord a => a ~> a -> Boolean
201
- * @param {RA.Identity} ord
202
- * @return {boolean}
203
- * @example
204
- *
205
- * const a = Identity.of(1);
206
- * const b = Identity.of(1);
207
- * const c = Identity.of(2);
208
- *
209
- * a.lte(b); //=> true
210
- * a.lte(c); //=> true
211
- * c.lte(a); //=> false
212
- */
213
- [fl.lte](ord) {
214
- return ordTrait[fl.lte].call(this, ord);
215
- }
216
-
217
- lte(ord) {
218
- return this[fl.lte](ord);
219
- }
220
-
221
- /**
222
- * Fantasy land {@link https://github.com/fantasyland/fantasy-land#monoid|Monoid*} specification.
223
- * Partial implementation of Monoid specification. `empty` method on instance only, returning
224
- * identity value of the wrapped type. Using `R.empty` under the hood.
225
- *
226
- *
227
- * @sig empty :: Monoid m => () -> m
228
- * @return {RA.Identity}
229
- * @example
230
- *
231
- * const a = Identity.of('test');
232
- * const i = a.empty();
233
- *
234
- * a.concat(i); //=> Identity('string');
235
- * i.concat(a); //=> Identity('string');
236
- */
237
- [fl.empty]() {
238
- return this.constructor.of(emptyR(this.value));
239
- }
240
-
241
- empty() {
242
- return this[fl.empty]();
243
- }
244
-
245
- /**
246
- * Fantasy land {@link https://github.com/fantasyland/fantasy-land#contravariant|Contravariant} specification.
247
- *
248
- * @sig contramap :: Contravariant f => f a ~> (b -> a) -> f b
249
- * @param {Function} fn
250
- * @return {RA.Identity}
251
- * @example
252
- *
253
- * const identity = a => a;
254
- * const add1 = a => a + 1;
255
- * const divide2 = a => a / 2;
256
- *
257
- * Identity.of(divide2).contramap(add1).get()(3); //=> 2
258
- * Identity.of(identity).contramap(divide2).contramap(add1).get()(3); //=> 2
259
- * Identity.of(identity).contramap(a => divide2(add1(a))).get()(3); //=> 2
260
- */
261
- [fl.contramap](fn) {
262
- return this.constructor.of((value) => this.value(fn(value)));
263
- }
264
-
265
- contramap(fn) {
266
- return this[fl.contramap](fn);
267
- }
268
- }
269
-
270
- export default Identity;
@@ -1,20 +0,0 @@
1
- export const equals = 'fantasy-land/equals';
2
- export const lte = 'fantasy-land/lte';
3
- export const compose = 'fantasy-land/compose';
4
- export const id = 'fantasy-land/id';
5
- export const concat = 'fantasy-land/concat';
6
- export const empty = 'fantasy-land/empty';
7
- export const map = 'fantasy-land/map';
8
- export const contramap = 'fantasy-land/contramap';
9
- export const ap = 'fantasy-land/ap';
10
- export const of = 'fantasy-land/of';
11
- export const alt = 'fantasy-land/alt';
12
- export const zero = 'fantasy-land/zero';
13
- export const reduce = 'fantasy-land/reduce';
14
- export const traverse = 'fantasy-land/traverse';
15
- export const chain = 'fantasy-land/chain';
16
- export const chainRec = 'fantasy-land/chainRec';
17
- export const extend = 'fantasy-land/extend';
18
- export const extract = 'fantasy-land/extract';
19
- export const bimap = 'fantasy-land/bimap';
20
- export const promap = 'fantasy-land/promap';