common-fp 0.1.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 (645) hide show
  1. package/dist/add.cjs +13 -0
  2. package/dist/add.d.cts +2 -0
  3. package/dist/add.d.ts +1 -0
  4. package/dist/add.mjs +13 -0
  5. package/dist/all.cjs +23 -0
  6. package/dist/all.d.cts +2 -0
  7. package/dist/all.d.ts +1 -0
  8. package/dist/all.mjs +23 -0
  9. package/dist/alter.cjs +24 -0
  10. package/dist/alter.d.cts +2 -0
  11. package/dist/alter.d.ts +1 -0
  12. package/dist/alter.mjs +24 -0
  13. package/dist/any.cjs +22 -0
  14. package/dist/any.d.cts +2 -0
  15. package/dist/any.d.ts +1 -0
  16. package/dist/any.mjs +22 -0
  17. package/dist/append-all.cjs +13 -0
  18. package/dist/append-all.d.cts +2 -0
  19. package/dist/append-all.d.ts +1 -0
  20. package/dist/append-all.mjs +13 -0
  21. package/dist/append-one.cjs +9 -0
  22. package/dist/append-one.d.cts +2 -0
  23. package/dist/append-one.d.ts +1 -0
  24. package/dist/append-one.mjs +9 -0
  25. package/dist/append.cjs +13 -0
  26. package/dist/append.d.cts +2 -0
  27. package/dist/append.d.ts +1 -0
  28. package/dist/append.mjs +13 -0
  29. package/dist/assign-defaults.cjs +43 -0
  30. package/dist/assign-defaults.d.cts +2 -0
  31. package/dist/assign-defaults.d.ts +1 -0
  32. package/dist/assign-defaults.mjs +43 -0
  33. package/dist/assign-overrides.cjs +43 -0
  34. package/dist/assign-overrides.d.cts +2 -0
  35. package/dist/assign-overrides.d.ts +1 -0
  36. package/dist/assign-overrides.mjs +43 -0
  37. package/dist/compare-by-path.cjs +24 -0
  38. package/dist/compare-by-path.d.cts +2 -0
  39. package/dist/compare-by-path.d.ts +1 -0
  40. package/dist/compare-by-path.mjs +24 -0
  41. package/dist/compare-by-prop.cjs +23 -0
  42. package/dist/compare-by-prop.d.cts +2 -0
  43. package/dist/compare-by-prop.d.ts +1 -0
  44. package/dist/compare-by-prop.mjs +23 -0
  45. package/dist/compose.cjs +15 -0
  46. package/dist/compose.d.cts +2 -0
  47. package/dist/compose.d.ts +1 -0
  48. package/dist/compose.mjs +15 -0
  49. package/dist/contained-in.cjs +26 -0
  50. package/dist/contained-in.d.cts +2 -0
  51. package/dist/contained-in.d.ts +1 -0
  52. package/dist/contained-in.mjs +26 -0
  53. package/dist/contains.cjs +28 -0
  54. package/dist/contains.d.cts +2 -0
  55. package/dist/contains.d.ts +1 -0
  56. package/dist/contains.mjs +28 -0
  57. package/dist/date-is-between.cjs +31 -0
  58. package/dist/date-is-between.d.cts +2 -0
  59. package/dist/date-is-between.d.ts +1 -0
  60. package/dist/date-is-between.mjs +31 -0
  61. package/dist/default-falsey-val-to.cjs +3 -0
  62. package/dist/default-falsey-val-to.d.cts +2 -0
  63. package/dist/default-falsey-val-to.d.ts +1 -0
  64. package/dist/default-falsey-val-to.mjs +3 -0
  65. package/dist/default-nullish-val-to.cjs +3 -0
  66. package/dist/default-nullish-val-to.d.cts +2 -0
  67. package/dist/default-nullish-val-to.d.ts +1 -0
  68. package/dist/default-nullish-val-to.mjs +3 -0
  69. package/dist/discard-first-while.cjs +18 -0
  70. package/dist/discard-first-while.d.cts +2 -0
  71. package/dist/discard-first-while.d.ts +1 -0
  72. package/dist/discard-first-while.mjs +18 -0
  73. package/dist/discard-first.cjs +16 -0
  74. package/dist/discard-first.d.cts +2 -0
  75. package/dist/discard-first.d.ts +1 -0
  76. package/dist/discard-first.mjs +16 -0
  77. package/dist/discard-last-while.cjs +17 -0
  78. package/dist/discard-last-while.d.cts +2 -0
  79. package/dist/discard-last-while.d.ts +1 -0
  80. package/dist/discard-last-while.mjs +17 -0
  81. package/dist/discard-last.cjs +16 -0
  82. package/dist/discard-last.d.cts +2 -0
  83. package/dist/discard-last.d.ts +1 -0
  84. package/dist/discard-last.mjs +16 -0
  85. package/dist/discard-range.cjs +31 -0
  86. package/dist/discard-range.d.cts +2 -0
  87. package/dist/discard-range.d.ts +1 -0
  88. package/dist/discard-range.mjs +31 -0
  89. package/dist/discard-when.cjs +55 -0
  90. package/dist/discard-when.d.cts +2 -0
  91. package/dist/discard-when.d.ts +1 -0
  92. package/dist/discard-when.mjs +55 -0
  93. package/dist/discard.cjs +57 -0
  94. package/dist/discard.d.cts +2 -0
  95. package/dist/discard.d.ts +1 -0
  96. package/dist/discard.mjs +57 -0
  97. package/dist/divide-by.cjs +13 -0
  98. package/dist/divide-by.d.cts +2 -0
  99. package/dist/divide-by.d.ts +1 -0
  100. package/dist/divide-by.mjs +13 -0
  101. package/dist/ends-with.cjs +13 -0
  102. package/dist/ends-with.d.cts +2 -0
  103. package/dist/ends-with.d.ts +1 -0
  104. package/dist/ends-with.mjs +13 -0
  105. package/dist/expand-end.cjs +16 -0
  106. package/dist/expand-end.d.cts +2 -0
  107. package/dist/expand-end.d.ts +1 -0
  108. package/dist/expand-end.mjs +16 -0
  109. package/dist/expand-start.cjs +16 -0
  110. package/dist/expand-start.d.cts +2 -0
  111. package/dist/expand-start.d.ts +1 -0
  112. package/dist/expand-start.mjs +16 -0
  113. package/dist/expand.cjs +22 -0
  114. package/dist/expand.d.cts +2 -0
  115. package/dist/expand.d.ts +1 -0
  116. package/dist/expand.mjs +22 -0
  117. package/dist/fill-range-with.cjs +18 -0
  118. package/dist/fill-range-with.d.cts +2 -0
  119. package/dist/fill-range-with.d.ts +1 -0
  120. package/dist/fill-range-with.mjs +18 -0
  121. package/dist/fill-with.cjs +34 -0
  122. package/dist/fill-with.d.cts +2 -0
  123. package/dist/fill-with.d.ts +1 -0
  124. package/dist/fill-with.mjs +34 -0
  125. package/dist/find-key-with-val.cjs +46 -0
  126. package/dist/find-key-with-val.d.cts +2 -0
  127. package/dist/find-key-with-val.d.ts +1 -0
  128. package/dist/find-key-with-val.mjs +46 -0
  129. package/dist/find-key.cjs +21 -0
  130. package/dist/find-key.d.cts +2 -0
  131. package/dist/find-key.d.ts +1 -0
  132. package/dist/find-key.mjs +21 -0
  133. package/dist/find-last-key-with-val.cjs +23 -0
  134. package/dist/find-last-key-with-val.d.cts +2 -0
  135. package/dist/find-last-key-with-val.d.ts +1 -0
  136. package/dist/find-last-key-with-val.mjs +23 -0
  137. package/dist/find-last-key.cjs +16 -0
  138. package/dist/find-last-key.d.cts +2 -0
  139. package/dist/find-last-key.d.ts +1 -0
  140. package/dist/find-last-key.mjs +16 -0
  141. package/dist/find-last.cjs +16 -0
  142. package/dist/find-last.d.cts +2 -0
  143. package/dist/find-last.d.ts +1 -0
  144. package/dist/find-last.mjs +16 -0
  145. package/dist/find.cjs +21 -0
  146. package/dist/find.d.cts +2 -0
  147. package/dist/find.d.ts +1 -0
  148. package/dist/find.mjs +21 -0
  149. package/dist/first.cjs +10 -0
  150. package/dist/first.d.cts +2 -0
  151. package/dist/first.d.ts +1 -0
  152. package/dist/first.mjs +10 -0
  153. package/dist/flatten-fully.cjs +9 -0
  154. package/dist/flatten-fully.d.cts +2 -0
  155. package/dist/flatten-fully.d.ts +1 -0
  156. package/dist/flatten-fully.mjs +9 -0
  157. package/dist/flatten-once.cjs +9 -0
  158. package/dist/flatten-once.d.cts +2 -0
  159. package/dist/flatten-once.d.ts +1 -0
  160. package/dist/flatten-once.mjs +9 -0
  161. package/dist/flatten-to-depth.cjs +15 -0
  162. package/dist/flatten-to-depth.d.cts +2 -0
  163. package/dist/flatten-to-depth.d.ts +1 -0
  164. package/dist/flatten-to-depth.mjs +15 -0
  165. package/dist/for-each.cjs +22 -0
  166. package/dist/for-each.d.cts +2 -0
  167. package/dist/for-each.d.ts +1 -0
  168. package/dist/for-each.mjs +22 -0
  169. package/dist/get-at-path.cjs +11 -0
  170. package/dist/get-at-path.d.cts +2 -0
  171. package/dist/get-at-path.d.ts +1 -0
  172. package/dist/get-at-path.mjs +11 -0
  173. package/dist/get-average-value.cjs +19 -0
  174. package/dist/get-average-value.d.cts +2 -0
  175. package/dist/get-average-value.d.ts +1 -0
  176. package/dist/get-average-value.mjs +19 -0
  177. package/dist/get-common-values.cjs +31 -0
  178. package/dist/get-common-values.d.cts +2 -0
  179. package/dist/get-common-values.d.ts +1 -0
  180. package/dist/get-common-values.mjs +31 -0
  181. package/dist/get-exclusive-values.cjs +41 -0
  182. package/dist/get-exclusive-values.d.cts +2 -0
  183. package/dist/get-exclusive-values.d.ts +1 -0
  184. package/dist/get-exclusive-values.mjs +41 -0
  185. package/dist/get-keys.cjs +23 -0
  186. package/dist/get-keys.d.cts +2 -0
  187. package/dist/get-keys.d.ts +1 -0
  188. package/dist/get-keys.mjs +23 -0
  189. package/dist/get-max-value.cjs +16 -0
  190. package/dist/get-max-value.d.cts +2 -0
  191. package/dist/get-max-value.d.ts +1 -0
  192. package/dist/get-max-value.mjs +16 -0
  193. package/dist/get-min-value.cjs +16 -0
  194. package/dist/get-min-value.d.cts +2 -0
  195. package/dist/get-min-value.d.ts +1 -0
  196. package/dist/get-min-value.mjs +16 -0
  197. package/dist/get-random-value.cjs +18 -0
  198. package/dist/get-random-value.d.cts +2 -0
  199. package/dist/get-random-value.d.ts +1 -0
  200. package/dist/get-random-value.mjs +18 -0
  201. package/dist/get-size.cjs +28 -0
  202. package/dist/get-size.d.cts +2 -0
  203. package/dist/get-size.d.ts +1 -0
  204. package/dist/get-size.mjs +28 -0
  205. package/dist/get-value-at-map-key.cjs +8 -0
  206. package/dist/get-value-at-map-key.d.cts +2 -0
  207. package/dist/get-value-at-map-key.d.ts +1 -0
  208. package/dist/get-value-at-map-key.mjs +8 -0
  209. package/dist/get-values.cjs +22 -0
  210. package/dist/get-values.d.cts +2 -0
  211. package/dist/get-values.d.ts +1 -0
  212. package/dist/get-values.mjs +22 -0
  213. package/dist/get.cjs +10 -0
  214. package/dist/get.d.cts +2 -0
  215. package/dist/get.d.ts +1 -0
  216. package/dist/get.mjs +10 -0
  217. package/dist/greater-than-or-equal-to.cjs +13 -0
  218. package/dist/greater-than-or-equal-to.d.cts +2 -0
  219. package/dist/greater-than-or-equal-to.d.ts +1 -0
  220. package/dist/greater-than-or-equal-to.mjs +13 -0
  221. package/dist/greater-than.cjs +13 -0
  222. package/dist/greater-than.d.cts +2 -0
  223. package/dist/greater-than.d.ts +1 -0
  224. package/dist/greater-than.mjs +13 -0
  225. package/dist/group-by.cjs +28 -0
  226. package/dist/group-by.d.cts +2 -0
  227. package/dist/group-by.d.ts +1 -0
  228. package/dist/group-by.mjs +28 -0
  229. package/dist/index.cjs +160 -0
  230. package/dist/index.d.cts +2 -0
  231. package/dist/index.d.ts +1 -0
  232. package/dist/index.mjs +158 -0
  233. package/dist/internal/contains-type-to-fn.cjs +33 -0
  234. package/dist/internal/contains-type-to-fn.mjs +33 -0
  235. package/dist/internal/get-at-path.cjs +12 -0
  236. package/dist/internal/get-at-path.mjs +12 -0
  237. package/dist/internal/validate-prune-arg.cjs +43 -0
  238. package/dist/internal/validate-prune-arg.mjs +43 -0
  239. package/dist/invert.cjs +29 -0
  240. package/dist/invert.d.cts +2 -0
  241. package/dist/invert.d.ts +1 -0
  242. package/dist/invert.mjs +29 -0
  243. package/dist/invoke-with.cjs +11 -0
  244. package/dist/invoke-with.d.cts +2 -0
  245. package/dist/invoke-with.d.ts +1 -0
  246. package/dist/invoke-with.mjs +11 -0
  247. package/dist/is-after.cjs +13 -0
  248. package/dist/is-after.d.cts +2 -0
  249. package/dist/is-after.d.ts +1 -0
  250. package/dist/is-after.mjs +13 -0
  251. package/dist/is-at-or-after.cjs +13 -0
  252. package/dist/is-at-or-after.d.cts +2 -0
  253. package/dist/is-at-or-after.d.ts +1 -0
  254. package/dist/is-at-or-after.mjs +13 -0
  255. package/dist/is-at-or-before.cjs +13 -0
  256. package/dist/is-at-or-before.d.cts +2 -0
  257. package/dist/is-at-or-before.d.ts +1 -0
  258. package/dist/is-at-or-before.mjs +13 -0
  259. package/dist/is-before.cjs +13 -0
  260. package/dist/is-before.d.cts +2 -0
  261. package/dist/is-before.d.ts +1 -0
  262. package/dist/is-before.mjs +13 -0
  263. package/dist/is-empty.cjs +28 -0
  264. package/dist/is-empty.d.cts +2 -0
  265. package/dist/is-empty.d.ts +1 -0
  266. package/dist/is-empty.mjs +28 -0
  267. package/dist/is-falsey.cjs +3 -0
  268. package/dist/is-falsey.d.cts +2 -0
  269. package/dist/is-falsey.d.ts +1 -0
  270. package/dist/is-falsey.mjs +3 -0
  271. package/dist/is-laden.cjs +28 -0
  272. package/dist/is-laden.d.cts +2 -0
  273. package/dist/is-laden.d.ts +1 -0
  274. package/dist/is-laden.mjs +28 -0
  275. package/dist/is-truthy.cjs +3 -0
  276. package/dist/is-truthy.d.cts +2 -0
  277. package/dist/is-truthy.d.ts +1 -0
  278. package/dist/is-truthy.mjs +3 -0
  279. package/dist/join-values.cjs +18 -0
  280. package/dist/join-values.d.cts +2 -0
  281. package/dist/join-values.d.ts +1 -0
  282. package/dist/join-values.mjs +18 -0
  283. package/dist/keep-first-while.cjs +18 -0
  284. package/dist/keep-first-while.d.cts +2 -0
  285. package/dist/keep-first-while.d.ts +1 -0
  286. package/dist/keep-first-while.mjs +18 -0
  287. package/dist/keep-first.cjs +14 -0
  288. package/dist/keep-first.d.cts +2 -0
  289. package/dist/keep-first.d.ts +1 -0
  290. package/dist/keep-first.mjs +14 -0
  291. package/dist/keep-last-while.cjs +18 -0
  292. package/dist/keep-last-while.d.cts +2 -0
  293. package/dist/keep-last-while.d.ts +1 -0
  294. package/dist/keep-last-while.mjs +18 -0
  295. package/dist/keep-last.cjs +14 -0
  296. package/dist/keep-last.d.cts +2 -0
  297. package/dist/keep-last.d.ts +1 -0
  298. package/dist/keep-last.mjs +14 -0
  299. package/dist/keep-range.cjs +14 -0
  300. package/dist/keep-range.d.cts +2 -0
  301. package/dist/keep-range.d.ts +1 -0
  302. package/dist/keep-range.mjs +14 -0
  303. package/dist/keep-when.cjs +54 -0
  304. package/dist/keep-when.d.cts +2 -0
  305. package/dist/keep-when.d.ts +1 -0
  306. package/dist/keep-when.mjs +54 -0
  307. package/dist/keep.cjs +63 -0
  308. package/dist/keep.d.cts +2 -0
  309. package/dist/keep.d.ts +1 -0
  310. package/dist/keep.mjs +63 -0
  311. package/dist/last.cjs +10 -0
  312. package/dist/last.d.cts +2 -0
  313. package/dist/last.d.ts +1 -0
  314. package/dist/last.mjs +10 -0
  315. package/dist/less-than-or-equal-to.cjs +13 -0
  316. package/dist/less-than-or-equal-to.d.cts +2 -0
  317. package/dist/less-than-or-equal-to.d.ts +1 -0
  318. package/dist/less-than-or-equal-to.mjs +13 -0
  319. package/dist/less-than.cjs +13 -0
  320. package/dist/less-than.d.cts +2 -0
  321. package/dist/less-than.d.ts +1 -0
  322. package/dist/less-than.mjs +13 -0
  323. package/dist/m-append-all.cjs +14 -0
  324. package/dist/m-append-all.d.cts +2 -0
  325. package/dist/m-append-all.d.ts +1 -0
  326. package/dist/m-append-all.mjs +14 -0
  327. package/dist/m-append-one.cjs +10 -0
  328. package/dist/m-append-one.d.cts +2 -0
  329. package/dist/m-append-one.d.ts +1 -0
  330. package/dist/m-append-one.mjs +10 -0
  331. package/dist/m-assign-defaults.cjs +51 -0
  332. package/dist/m-assign-defaults.d.cts +2 -0
  333. package/dist/m-assign-defaults.d.ts +1 -0
  334. package/dist/m-assign-defaults.mjs +51 -0
  335. package/dist/m-assign-overrides.cjs +47 -0
  336. package/dist/m-assign-overrides.d.cts +2 -0
  337. package/dist/m-assign-overrides.d.ts +1 -0
  338. package/dist/m-assign-overrides.mjs +47 -0
  339. package/dist/m-discard-first-while.cjs +19 -0
  340. package/dist/m-discard-first-while.d.cts +2 -0
  341. package/dist/m-discard-first-while.d.ts +1 -0
  342. package/dist/m-discard-first-while.mjs +19 -0
  343. package/dist/m-discard-first.cjs +16 -0
  344. package/dist/m-discard-first.d.cts +2 -0
  345. package/dist/m-discard-first.d.ts +1 -0
  346. package/dist/m-discard-first.mjs +16 -0
  347. package/dist/m-discard-last-while.cjs +20 -0
  348. package/dist/m-discard-last-while.d.cts +2 -0
  349. package/dist/m-discard-last-while.d.ts +1 -0
  350. package/dist/m-discard-last-while.mjs +20 -0
  351. package/dist/m-discard-last.cjs +16 -0
  352. package/dist/m-discard-last.d.cts +2 -0
  353. package/dist/m-discard-last.d.ts +1 -0
  354. package/dist/m-discard-last.mjs +16 -0
  355. package/dist/m-discard-range.cjs +17 -0
  356. package/dist/m-discard-range.d.cts +2 -0
  357. package/dist/m-discard-range.d.ts +1 -0
  358. package/dist/m-discard-range.mjs +17 -0
  359. package/dist/m-fill-range-with.cjs +17 -0
  360. package/dist/m-fill-range-with.d.cts +2 -0
  361. package/dist/m-fill-range-with.d.ts +1 -0
  362. package/dist/m-fill-range-with.mjs +17 -0
  363. package/dist/m-fill-with.cjs +32 -0
  364. package/dist/m-fill-with.d.cts +2 -0
  365. package/dist/m-fill-with.d.ts +1 -0
  366. package/dist/m-fill-with.mjs +32 -0
  367. package/dist/m-keep-first-while.cjs +19 -0
  368. package/dist/m-keep-first-while.d.cts +2 -0
  369. package/dist/m-keep-first-while.d.ts +1 -0
  370. package/dist/m-keep-first-while.mjs +19 -0
  371. package/dist/m-keep-first.cjs +14 -0
  372. package/dist/m-keep-first.d.cts +2 -0
  373. package/dist/m-keep-first.d.ts +1 -0
  374. package/dist/m-keep-first.mjs +14 -0
  375. package/dist/m-keep-last-while.cjs +19 -0
  376. package/dist/m-keep-last-while.d.cts +2 -0
  377. package/dist/m-keep-last-while.d.ts +1 -0
  378. package/dist/m-keep-last-while.mjs +19 -0
  379. package/dist/m-keep-last.cjs +14 -0
  380. package/dist/m-keep-last.d.cts +2 -0
  381. package/dist/m-keep-last.d.ts +1 -0
  382. package/dist/m-keep-last.mjs +14 -0
  383. package/dist/m-keep-range.cjs +18 -0
  384. package/dist/m-keep-range.d.cts +2 -0
  385. package/dist/m-keep-range.d.ts +1 -0
  386. package/dist/m-keep-range.mjs +18 -0
  387. package/dist/m-map-values.cjs +47 -0
  388. package/dist/m-map-values.d.cts +2 -0
  389. package/dist/m-map-values.d.ts +1 -0
  390. package/dist/m-map-values.mjs +47 -0
  391. package/dist/m-omit.cjs +62 -0
  392. package/dist/m-omit.d.cts +2 -0
  393. package/dist/m-omit.d.ts +1 -0
  394. package/dist/m-omit.mjs +62 -0
  395. package/dist/m-order.cjs +13 -0
  396. package/dist/m-order.d.cts +2 -0
  397. package/dist/m-order.d.ts +1 -0
  398. package/dist/m-order.mjs +13 -0
  399. package/dist/m-pick.cjs +67 -0
  400. package/dist/m-pick.d.cts +2 -0
  401. package/dist/m-pick.d.ts +1 -0
  402. package/dist/m-pick.mjs +67 -0
  403. package/dist/m-prepend-all.cjs +14 -0
  404. package/dist/m-prepend-all.d.cts +2 -0
  405. package/dist/m-prepend-all.d.ts +1 -0
  406. package/dist/m-prepend-all.mjs +14 -0
  407. package/dist/m-prepend-one.cjs +10 -0
  408. package/dist/m-prepend-one.d.cts +2 -0
  409. package/dist/m-prepend-one.d.ts +1 -0
  410. package/dist/m-prepend-one.mjs +10 -0
  411. package/dist/m-reverse.cjs +8 -0
  412. package/dist/m-reverse.d.cts +2 -0
  413. package/dist/m-reverse.d.ts +1 -0
  414. package/dist/m-reverse.mjs +8 -0
  415. package/dist/m-set-at-path.cjs +40 -0
  416. package/dist/m-set-at-path.d.cts +2 -0
  417. package/dist/m-set-at-path.d.ts +1 -0
  418. package/dist/m-set-at-path.mjs +40 -0
  419. package/dist/m-set.cjs +21 -0
  420. package/dist/m-set.d.cts +2 -0
  421. package/dist/m-set.d.ts +1 -0
  422. package/dist/m-set.mjs +21 -0
  423. package/dist/m-shuffle.cjs +20 -0
  424. package/dist/m-shuffle.d.cts +2 -0
  425. package/dist/m-shuffle.d.ts +1 -0
  426. package/dist/m-shuffle.mjs +20 -0
  427. package/dist/m-update.cjs +68 -0
  428. package/dist/m-update.d.cts +2 -0
  429. package/dist/m-update.d.ts +1 -0
  430. package/dist/m-update.mjs +68 -0
  431. package/dist/map-keys.cjs +36 -0
  432. package/dist/map-keys.d.cts +2 -0
  433. package/dist/map-keys.d.ts +1 -0
  434. package/dist/map-keys.mjs +36 -0
  435. package/dist/map-values.cjs +50 -0
  436. package/dist/map-values.d.cts +2 -0
  437. package/dist/map-values.d.ts +1 -0
  438. package/dist/map-values.mjs +50 -0
  439. package/dist/multiply-by.cjs +13 -0
  440. package/dist/multiply-by.d.cts +2 -0
  441. package/dist/multiply-by.d.ts +1 -0
  442. package/dist/multiply-by.mjs +13 -0
  443. package/dist/negate.cjs +9 -0
  444. package/dist/negate.d.cts +2 -0
  445. package/dist/negate.d.ts +1 -0
  446. package/dist/negate.mjs +9 -0
  447. package/dist/number-is-between.cjs +33 -0
  448. package/dist/number-is-between.d.cts +2 -0
  449. package/dist/number-is-between.d.ts +1 -0
  450. package/dist/number-is-between.mjs +33 -0
  451. package/dist/omit.cjs +52 -0
  452. package/dist/omit.d.cts +2 -0
  453. package/dist/omit.d.ts +1 -0
  454. package/dist/omit.mjs +52 -0
  455. package/dist/order.cjs +13 -0
  456. package/dist/order.d.cts +2 -0
  457. package/dist/order.d.ts +1 -0
  458. package/dist/order.mjs +13 -0
  459. package/dist/p-all.cjs +23 -0
  460. package/dist/p-all.d.cts +2 -0
  461. package/dist/p-all.d.ts +1 -0
  462. package/dist/p-all.mjs +23 -0
  463. package/dist/p-any.cjs +23 -0
  464. package/dist/p-any.d.cts +2 -0
  465. package/dist/p-any.d.ts +1 -0
  466. package/dist/p-any.mjs +23 -0
  467. package/dist/p-compose.cjs +18 -0
  468. package/dist/p-compose.d.cts +2 -0
  469. package/dist/p-compose.d.ts +1 -0
  470. package/dist/p-compose.mjs +18 -0
  471. package/dist/p-discard-when.cjs +64 -0
  472. package/dist/p-discard-when.d.cts +2 -0
  473. package/dist/p-discard-when.d.ts +1 -0
  474. package/dist/p-discard-when.mjs +64 -0
  475. package/dist/p-find.cjs +21 -0
  476. package/dist/p-find.d.cts +2 -0
  477. package/dist/p-find.d.ts +1 -0
  478. package/dist/p-find.mjs +21 -0
  479. package/dist/p-for-each.cjs +21 -0
  480. package/dist/p-for-each.d.cts +2 -0
  481. package/dist/p-for-each.d.ts +1 -0
  482. package/dist/p-for-each.mjs +21 -0
  483. package/dist/p-keep-when.cjs +64 -0
  484. package/dist/p-keep-when.d.cts +2 -0
  485. package/dist/p-keep-when.d.ts +1 -0
  486. package/dist/p-keep-when.mjs +64 -0
  487. package/dist/p-map-values.cjs +57 -0
  488. package/dist/p-map-values.d.cts +2 -0
  489. package/dist/p-map-values.d.ts +1 -0
  490. package/dist/p-map-values.mjs +57 -0
  491. package/dist/p-pass-through.cjs +12 -0
  492. package/dist/p-pass-through.d.cts +2 -0
  493. package/dist/p-pass-through.d.ts +1 -0
  494. package/dist/p-pass-through.mjs +12 -0
  495. package/dist/p-resolve-values.cjs +43 -0
  496. package/dist/p-resolve-values.d.cts +2 -0
  497. package/dist/p-resolve-values.d.ts +1 -0
  498. package/dist/p-resolve-values.mjs +43 -0
  499. package/dist/p-wait-ms.cjs +8 -0
  500. package/dist/p-wait-ms.d.cts +2 -0
  501. package/dist/p-wait-ms.d.ts +1 -0
  502. package/dist/p-wait-ms.mjs +8 -0
  503. package/dist/pass-through.cjs +9 -0
  504. package/dist/pass-through.d.cts +2 -0
  505. package/dist/pass-through.d.ts +1 -0
  506. package/dist/pass-through.mjs +9 -0
  507. package/dist/peek.cjs +13 -0
  508. package/dist/peek.d.cts +2 -0
  509. package/dist/peek.d.ts +1 -0
  510. package/dist/peek.mjs +13 -0
  511. package/dist/pick.cjs +50 -0
  512. package/dist/pick.d.cts +2 -0
  513. package/dist/pick.d.ts +1 -0
  514. package/dist/pick.mjs +50 -0
  515. package/dist/prepend-all.cjs +13 -0
  516. package/dist/prepend-all.d.cts +2 -0
  517. package/dist/prepend-all.d.ts +1 -0
  518. package/dist/prepend-all.mjs +13 -0
  519. package/dist/prepend-one.cjs +9 -0
  520. package/dist/prepend-one.d.cts +2 -0
  521. package/dist/prepend-one.d.ts +1 -0
  522. package/dist/prepend-one.mjs +9 -0
  523. package/dist/prepend.cjs +13 -0
  524. package/dist/prepend.d.cts +2 -0
  525. package/dist/prepend.d.ts +1 -0
  526. package/dist/prepend.mjs +13 -0
  527. package/dist/prune-end.cjs +18 -0
  528. package/dist/prune-end.d.cts +2 -0
  529. package/dist/prune-end.d.ts +1 -0
  530. package/dist/prune-end.mjs +18 -0
  531. package/dist/prune-start.cjs +18 -0
  532. package/dist/prune-start.d.cts +2 -0
  533. package/dist/prune-start.d.ts +1 -0
  534. package/dist/prune-start.mjs +18 -0
  535. package/dist/prune.cjs +21 -0
  536. package/dist/prune.d.cts +2 -0
  537. package/dist/prune.d.ts +1 -0
  538. package/dist/prune.mjs +21 -0
  539. package/dist/randomly-keep.cjs +83 -0
  540. package/dist/randomly-keep.d.cts +2 -0
  541. package/dist/randomly-keep.d.ts +1 -0
  542. package/dist/randomly-keep.mjs +83 -0
  543. package/dist/replace-all-matches.cjs +33 -0
  544. package/dist/replace-all-matches.d.cts +2 -0
  545. package/dist/replace-all-matches.d.ts +1 -0
  546. package/dist/replace-all-matches.mjs +33 -0
  547. package/dist/replace-first-match.cjs +38 -0
  548. package/dist/replace-first-match.d.cts +2 -0
  549. package/dist/replace-first-match.d.ts +1 -0
  550. package/dist/replace-first-match.mjs +38 -0
  551. package/dist/return-first-arg.cjs +4 -0
  552. package/dist/return-first-arg.d.cts +2 -0
  553. package/dist/return-first-arg.d.ts +1 -0
  554. package/dist/return-first-arg.mjs +4 -0
  555. package/dist/return-undefined.cjs +4 -0
  556. package/dist/return-undefined.d.cts +2 -0
  557. package/dist/return-undefined.d.ts +1 -0
  558. package/dist/return-undefined.mjs +4 -0
  559. package/dist/reverse.cjs +8 -0
  560. package/dist/reverse.d.cts +2 -0
  561. package/dist/reverse.d.ts +1 -0
  562. package/dist/reverse.mjs +8 -0
  563. package/dist/round-to-nearest.cjs +51 -0
  564. package/dist/round-to-nearest.d.cts +2 -0
  565. package/dist/round-to-nearest.d.ts +1 -0
  566. package/dist/round-to-nearest.mjs +51 -0
  567. package/dist/set.cjs +51 -0
  568. package/dist/set.d.cts +2 -0
  569. package/dist/set.d.ts +1 -0
  570. package/dist/set.mjs +51 -0
  571. package/dist/shuffle.cjs +21 -0
  572. package/dist/shuffle.d.cts +2 -0
  573. package/dist/shuffle.d.ts +1 -0
  574. package/dist/shuffle.mjs +21 -0
  575. package/dist/split-every.cjs +31 -0
  576. package/dist/split-every.d.cts +2 -0
  577. package/dist/split-every.d.ts +1 -0
  578. package/dist/split-every.mjs +31 -0
  579. package/dist/split.cjs +14 -0
  580. package/dist/split.d.cts +2 -0
  581. package/dist/split.d.ts +1 -0
  582. package/dist/split.mjs +14 -0
  583. package/dist/starts-with.cjs +13 -0
  584. package/dist/starts-with.d.cts +2 -0
  585. package/dist/starts-with.d.ts +1 -0
  586. package/dist/starts-with.mjs +13 -0
  587. package/dist/strict-equals.cjs +3 -0
  588. package/dist/strict-equals.d.cts +2 -0
  589. package/dist/strict-equals.d.ts +1 -0
  590. package/dist/strict-equals.mjs +3 -0
  591. package/dist/subtract.cjs +13 -0
  592. package/dist/subtract.d.cts +2 -0
  593. package/dist/subtract.d.ts +1 -0
  594. package/dist/subtract.mjs +13 -0
  595. package/dist/sum-values.cjs +20 -0
  596. package/dist/sum-values.d.cts +2 -0
  597. package/dist/sum-values.d.ts +1 -0
  598. package/dist/sum-values.mjs +20 -0
  599. package/dist/swap-first-two-args.cjs +15 -0
  600. package/dist/swap-first-two-args.d.cts +2 -0
  601. package/dist/swap-first-two-args.d.ts +1 -0
  602. package/dist/swap-first-two-args.mjs +15 -0
  603. package/dist/transpose.cjs +46 -0
  604. package/dist/transpose.d.cts +2 -0
  605. package/dist/transpose.d.ts +1 -0
  606. package/dist/transpose.mjs +46 -0
  607. package/dist/truncate-to-n-chars.cjs +17 -0
  608. package/dist/truncate-to-n-chars.d.cts +2 -0
  609. package/dist/truncate-to-n-chars.d.ts +1 -0
  610. package/dist/truncate-to-n-chars.mjs +17 -0
  611. package/dist/truncate-to-n-lines.cjs +58 -0
  612. package/dist/truncate-to-n-lines.d.cts +2 -0
  613. package/dist/truncate-to-n-lines.d.ts +1 -0
  614. package/dist/truncate-to-n-lines.mjs +58 -0
  615. package/dist/update.cjs +74 -0
  616. package/dist/update.d.cts +2 -0
  617. package/dist/update.d.ts +1 -0
  618. package/dist/update.mjs +74 -0
  619. package/dist/with-dates-ascending.cjs +3 -0
  620. package/dist/with-dates-ascending.d.cts +2 -0
  621. package/dist/with-dates-ascending.d.ts +1 -0
  622. package/dist/with-dates-ascending.mjs +3 -0
  623. package/dist/with-dates-descending.cjs +3 -0
  624. package/dist/with-dates-descending.d.cts +2 -0
  625. package/dist/with-dates-descending.d.ts +1 -0
  626. package/dist/with-dates-descending.mjs +3 -0
  627. package/dist/with-numbers-ascending.cjs +3 -0
  628. package/dist/with-numbers-ascending.d.cts +2 -0
  629. package/dist/with-numbers-ascending.d.ts +1 -0
  630. package/dist/with-numbers-ascending.mjs +3 -0
  631. package/dist/with-numbers-descending.cjs +3 -0
  632. package/dist/with-numbers-descending.d.cts +2 -0
  633. package/dist/with-numbers-descending.d.ts +1 -0
  634. package/dist/with-numbers-descending.mjs +3 -0
  635. package/dist/with-strings-ascending.cjs +4 -0
  636. package/dist/with-strings-ascending.d.cts +2 -0
  637. package/dist/with-strings-ascending.d.ts +1 -0
  638. package/dist/with-strings-ascending.mjs +4 -0
  639. package/dist/with-strings-descending.cjs +4 -0
  640. package/dist/with-strings-descending.d.cts +2 -0
  641. package/dist/with-strings-descending.d.ts +1 -0
  642. package/dist/with-strings-descending.mjs +4 -0
  643. package/license.txt +41 -0
  644. package/package.json +46 -0
  645. package/readme.md +108 -0
package/dist/index.mjs ADDED
@@ -0,0 +1,158 @@
1
+ export { default as add } from './add.mjs'
2
+ export { default as all } from './all.mjs'
3
+ export { default as alter } from './alter.mjs'
4
+ export { default as any } from './any.mjs'
5
+ export { default as append } from './append.mjs'
6
+ export { default as appendAll } from './append-all.mjs'
7
+ export { default as appendOne } from './append-one.mjs'
8
+ export { default as assignDefaults } from './assign-defaults.mjs'
9
+ export { default as assignOverrides } from './assign-overrides.mjs'
10
+ export { default as compareByPath } from './compare-by-path.mjs'
11
+ export { default as compareByProp } from './compare-by-prop.mjs'
12
+ export { default as compose } from './compose.mjs'
13
+ export { default as containedIn } from './contained-in.mjs'
14
+ export { default as contains } from './contains.mjs'
15
+ export { default as dateIsBetween } from './date-is-between.mjs'
16
+ export { default as defaultFalseyValTo } from './default-falsey-val-to.mjs'
17
+ export { default as defaultNullishValTo } from './default-nullish-val-to.mjs'
18
+ export { default as discard } from './discard.mjs'
19
+ export { default as discardFirst } from './discard-first.mjs'
20
+ export { default as discardFirstWhile } from './discard-first-while.mjs'
21
+ export { default as discardLast } from './discard-last.mjs'
22
+ export { default as discardLastWhile } from './discard-last-while.mjs'
23
+ export { default as discardRange } from './discard-range.mjs'
24
+ export { default as discardWhen } from './discard-when.mjs'
25
+ export { default as divideBy } from './divide-by.mjs'
26
+ export { default as endsWith } from './ends-with.mjs'
27
+ export { default as expand } from './expand.mjs'
28
+ export { default as expandEnd } from './expand-end.mjs'
29
+ export { default as expandStart } from './expand-start.mjs'
30
+ export { default as fillRangeWith } from './fill-range-with.mjs'
31
+ export { default as fillWith } from './fill-with.mjs'
32
+ export { default as find } from './find.mjs'
33
+ export { default as findKey } from './find-key.mjs'
34
+ export { default as findKeyWithVal } from './find-key-with-val.mjs'
35
+ export { default as findLast } from './find-last.mjs'
36
+ export { default as findLastKey } from './find-last-key.mjs'
37
+ export { default as findLastKeyWithVal } from './find-last-key-with-val.mjs'
38
+ export { default as first } from './first.mjs'
39
+ export { default as flattenFully } from './flatten-fully.mjs'
40
+ export { default as flattenOnce } from './flatten-once.mjs'
41
+ export { default as flattenToDepth } from './flatten-to-depth.mjs'
42
+ export { default as forEach } from './for-each.mjs'
43
+ export { default as get } from './get.mjs'
44
+ export { default as getAtPath } from './get-at-path.mjs'
45
+ export { default as getAverageValue } from './get-average-value.mjs'
46
+ export { default as getCommonValues } from './get-common-values.mjs'
47
+ export { default as getExclusiveValues } from './get-exclusive-values.mjs'
48
+ export { default as getKeys } from './get-keys.mjs'
49
+ export { default as getMaxValue } from './get-max-value.mjs'
50
+ export { default as getMinValue } from './get-min-value.mjs'
51
+ export { default as getRandomValue } from './get-random-value.mjs'
52
+ export { default as getSize } from './get-size.mjs'
53
+ export { default as getValueAtMapKey } from './get-value-at-map-key.mjs'
54
+ export { default as getValues } from './get-values.mjs'
55
+ export { default as greaterThan } from './greater-than.mjs'
56
+ export { default as greaterThanOrEqualTo } from './greater-than-or-equal-to.mjs'
57
+ export { default as groupBy } from './group-by.mjs'
58
+ export { default as invert } from './invert.mjs'
59
+ export { default as invokeWith } from './invoke-with.mjs'
60
+ export { default as isAfter } from './is-after.mjs'
61
+ export { default as isAtOrAfter } from './is-at-or-after.mjs'
62
+ export { default as isAtOrBefore } from './is-at-or-before.mjs'
63
+ export { default as isBefore } from './is-before.mjs'
64
+ export { default as isEmpty } from './is-empty.mjs'
65
+ export { default as isFalsey } from './is-falsey.mjs'
66
+ export { default as isLaden } from './is-laden.mjs'
67
+ export { default as isTruthy } from './is-truthy.mjs'
68
+ export { default as joinValues } from './join-values.mjs'
69
+ export { default as keep } from './keep.mjs'
70
+ export { default as keepFirst } from './keep-first.mjs'
71
+ export { default as keepFirstWhile } from './keep-first-while.mjs'
72
+ export { default as keepLast } from './keep-last.mjs'
73
+ export { default as keepLastWhile } from './keep-last-while.mjs'
74
+ export { default as keepRange } from './keep-range.mjs'
75
+ export { default as keepWhen } from './keep-when.mjs'
76
+ export { default as last } from './last.mjs'
77
+ export { default as lessThan } from './less-than.mjs'
78
+ export { default as lessThanOrEqualTo } from './less-than-or-equal-to.mjs'
79
+ export { default as mapKeys } from './map-keys.mjs'
80
+ export { default as mAppendAll } from './m-append-all.mjs'
81
+ export { default as mAppendOne } from './m-append-one.mjs'
82
+ export { default as mapValues } from './map-values.mjs'
83
+ export { default as mAssignDefaults } from './m-assign-defaults.mjs'
84
+ export { default as mAssignOverrides } from './m-assign-overrides.mjs'
85
+ export { default as mDiscardFirst } from './m-discard-first.mjs'
86
+ export { default as mDiscardFirstWhile } from './m-discard-first-while.mjs'
87
+ export { default as mDiscardLast } from './m-discard-last.mjs'
88
+ export { default as mDiscardLastWhile } from './m-discard-last-while.mjs'
89
+ export { default as mDiscardRange } from './m-discard-range.mjs'
90
+ export { default as mFillRangeWith } from './m-fill-range-with.mjs'
91
+ export { default as mFillWith } from './m-fill-with.mjs'
92
+ export { default as mKeepFirst } from './m-keep-first.mjs'
93
+ export { default as mKeepFirstWhile } from './m-keep-first-while.mjs'
94
+ export { default as mKeepLast } from './m-keep-last.mjs'
95
+ export { default as mKeepLastWhile } from './m-keep-last-while.mjs'
96
+ export { default as mKeepRange } from './m-keep-range.mjs'
97
+ export { default as mMapValues } from './m-map-values.mjs'
98
+ export { default as mOmit } from './m-omit.mjs'
99
+ export { default as mOrder } from './m-order.mjs'
100
+ export { default as mPick } from './m-pick.mjs'
101
+ export { default as mPrependAll } from './m-prepend-all.mjs'
102
+ export { default as mPrependOne } from './m-prepend-one.mjs'
103
+ export { default as mReverse } from './m-reverse.mjs'
104
+ export { default as mSet } from './m-set.mjs'
105
+ export { default as mSetAtPath } from './m-set-at-path.mjs'
106
+ export { default as mShuffle } from './m-shuffle.mjs'
107
+ export { default as multiplyBy } from './multiply-by.mjs'
108
+ export { default as mUpdate } from './m-update.mjs'
109
+ export { default as negate } from './negate.mjs'
110
+ export { default as numberIsBetween } from './number-is-between.mjs'
111
+ export { default as omit } from './omit.mjs'
112
+ export { default as order } from './order.mjs'
113
+ export { default as pAll } from './p-all.mjs'
114
+ export { default as pAny } from './p-any.mjs'
115
+ export { default as passThrough } from './pass-through.mjs'
116
+ export { default as pCompose } from './p-compose.mjs'
117
+ export { default as pDiscardWhen } from './p-discard-when.mjs'
118
+ export { default as peek } from './peek.mjs'
119
+ export { default as pFind } from './p-find.mjs'
120
+ export { default as pForEach } from './p-for-each.mjs'
121
+ export { default as pick } from './pick.mjs'
122
+ export { default as pKeepWhen } from './p-keep-when.mjs'
123
+ export { default as pMapValues } from './p-map-values.mjs'
124
+ export { default as pPassThrough } from './p-pass-through.mjs'
125
+ export { default as prepend } from './prepend.mjs'
126
+ export { default as prependAll } from './prepend-all.mjs'
127
+ export { default as prependOne } from './prepend-one.mjs'
128
+ export { default as pResolveValues } from './p-resolve-values.mjs'
129
+ export { default as prune } from './prune.mjs'
130
+ export { default as pruneEnd } from './prune-end.mjs'
131
+ export { default as pruneStart } from './prune-start.mjs'
132
+ export { default as pWaitMs } from './p-wait-ms.mjs'
133
+ export { default as randomlyKeep } from './randomly-keep.mjs'
134
+ export { default as replaceAllMatches } from './replace-all-matches.mjs'
135
+ export { default as replaceFirstMatch } from './replace-first-match.mjs'
136
+ export { default as returnFirstArg } from './return-first-arg.mjs'
137
+ export { default as returnUndefined } from './return-undefined.mjs'
138
+ export { default as reverse } from './reverse.mjs'
139
+ export { default as roundToNearest } from './round-to-nearest.mjs'
140
+ export { default as set } from './set.mjs'
141
+ export { default as shuffle } from './shuffle.mjs'
142
+ export { default as split } from './split.mjs'
143
+ export { default as splitEvery } from './split-every.mjs'
144
+ export { default as startsWith } from './starts-with.mjs'
145
+ export { default as strictEquals } from './strict-equals.mjs'
146
+ export { default as subtract } from './subtract.mjs'
147
+ export { default as sumValues } from './sum-values.mjs'
148
+ export { default as swapFirstTwoArgs } from './swap-first-two-args.mjs'
149
+ export { default as transpose } from './transpose.mjs'
150
+ export { default as truncateToNChars } from './truncate-to-n-chars.mjs'
151
+ export { default as truncateToNLines } from './truncate-to-n-lines.mjs'
152
+ export { default as update } from './update.mjs'
153
+ export { default as withDatesAscending } from './with-dates-ascending.mjs'
154
+ export { default as withDatesDescending } from './with-dates-descending.mjs'
155
+ export { default as withNumbersAscending } from './with-numbers-ascending.mjs'
156
+ export { default as withNumbersDescending } from './with-numbers-descending.mjs'
157
+ export { default as withStringsAscending } from './with-strings-ascending.mjs'
158
+ export { default as withStringsDescending } from './with-strings-descending.mjs'
@@ -0,0 +1,33 @@
1
+ const containsTypeToFn = {
2
+ array: contains_includes,
3
+ map: contains_map,
4
+ object: contains_object,
5
+ set: contains_set,
6
+ string: contains_string,
7
+ }
8
+
9
+ function contains_includes(arr, val) {
10
+ return arr.includes(val)
11
+ }
12
+
13
+ function contains_map(aMap, val) {
14
+ for (const v of aMap.values()) {
15
+ if (v === val) return true
16
+ }
17
+
18
+ return false
19
+ }
20
+
21
+ function contains_object(obj, val) {
22
+ return Object.values(obj).includes(val)
23
+ }
24
+
25
+ function contains_set(aSet, val) {
26
+ return aSet.has(val)
27
+ }
28
+
29
+ function contains_string(str, val) {
30
+ return str.includes(val)
31
+ }
32
+
33
+ module.exports = containsTypeToFn
@@ -0,0 +1,33 @@
1
+ const containsTypeToFn = {
2
+ array: contains_includes,
3
+ map: contains_map,
4
+ object: contains_object,
5
+ set: contains_set,
6
+ string: contains_string,
7
+ }
8
+
9
+ function contains_includes(arr, val) {
10
+ return arr.includes(val)
11
+ }
12
+
13
+ function contains_map(aMap, val) {
14
+ for (const v of aMap.values()) {
15
+ if (v === val) return true
16
+ }
17
+
18
+ return false
19
+ }
20
+
21
+ function contains_object(obj, val) {
22
+ return Object.values(obj).includes(val)
23
+ }
24
+
25
+ function contains_set(aSet, val) {
26
+ return aSet.has(val)
27
+ }
28
+
29
+ function contains_string(str, val) {
30
+ return str.includes(val)
31
+ }
32
+
33
+ export default containsTypeToFn
@@ -0,0 +1,12 @@
1
+ module.exports = (path, anObject) => {
2
+ if (!path.length) return anObject
3
+
4
+ let result = anObject
5
+ for (const key of path) {
6
+ result = result?.[key]
7
+
8
+ if (result === undefined) return
9
+ }
10
+
11
+ return result
12
+ }
@@ -0,0 +1,12 @@
1
+ export default (path, anObject) => {
2
+ if (!path.length) return anObject
3
+
4
+ let result = anObject
5
+ for (const key of path) {
6
+ result = result?.[key]
7
+
8
+ if (result === undefined) return
9
+ }
10
+
11
+ return result
12
+ }
@@ -0,0 +1,43 @@
1
+ const assertArgIsOneOfType = require('@common-fp/shared-internals/assert-arg-is-one-of-type')
2
+ const ct = require('@common-fp/shared-internals/common-types')
3
+ const getType = require('@common-fp/shared-internals/get-type')
4
+
5
+ const validatePruneArg = pruneArg => {
6
+ assertArgIsOneOfType(pruneArg, 'pruneArg', ct.sequence, 'prune')
7
+
8
+ if (typeof pruneArg === 'string') {
9
+ if (pruneArg.length !== 1) {
10
+ let msg = 'when passing a string to prune it must be a single character'
11
+ msg +=
12
+ pruneArg.length ?
13
+ '\nif you want to prune all characters in the string, pass an array of chars instead'
14
+ : '\nan empty string was passed instead'
15
+ throw new Error(msg)
16
+ }
17
+ } else {
18
+ // pruneArg is array
19
+ let nonStringType
20
+ let nonCharLength
21
+ for (const el of pruneArg) {
22
+ if (typeof el !== 'string') {
23
+ nonStringType = getType(el)
24
+ break
25
+ }
26
+ if (el.length !== 1) {
27
+ nonCharLength = el.length
28
+ break
29
+ }
30
+ }
31
+ if (nonStringType || nonCharLength) {
32
+ let msg =
33
+ 'when passing an array to prune it must contain all strings of a single character'
34
+ msg +=
35
+ nonStringType ?
36
+ `\n element found with type ${nonStringType}`
37
+ : `\n string found with length ${nonCharLength}`
38
+ throw new Error(msg)
39
+ }
40
+ }
41
+ }
42
+
43
+ module.exports = validatePruneArg
@@ -0,0 +1,43 @@
1
+ import assertArgIsOneOfType from '@common-fp/shared-internals/assert-arg-is-one-of-type'
2
+ import * as ct from '@common-fp/shared-internals/common-types'
3
+ import getType from '@common-fp/shared-internals/get-type'
4
+
5
+ const validatePruneArg = pruneArg => {
6
+ assertArgIsOneOfType(pruneArg, 'pruneArg', ct.sequence, 'prune')
7
+
8
+ if (typeof pruneArg === 'string') {
9
+ if (pruneArg.length !== 1) {
10
+ let msg = 'when passing a string to prune it must be a single character'
11
+ msg +=
12
+ pruneArg.length ?
13
+ '\nif you want to prune all characters in the string, pass an array of chars instead'
14
+ : '\nan empty string was passed instead'
15
+ throw new Error(msg)
16
+ }
17
+ } else {
18
+ // pruneArg is array
19
+ let nonStringType
20
+ let nonCharLength
21
+ for (const el of pruneArg) {
22
+ if (typeof el !== 'string') {
23
+ nonStringType = getType(el)
24
+ break
25
+ }
26
+ if (el.length !== 1) {
27
+ nonCharLength = el.length
28
+ break
29
+ }
30
+ }
31
+ if (nonStringType || nonCharLength) {
32
+ let msg =
33
+ 'when passing an array to prune it must contain all strings of a single character'
34
+ msg +=
35
+ nonStringType ?
36
+ `\n element found with type ${nonStringType}`
37
+ : `\n string found with length ${nonCharLength}`
38
+ throw new Error(msg)
39
+ }
40
+ }
41
+ }
42
+
43
+ export default validatePruneArg
@@ -0,0 +1,29 @@
1
+ const getFn = require('@common-fp/shared-internals/get-fn')
2
+
3
+ const invert = collection => {
4
+ const fn = getFn(typeToFn, collection, 'collection', 'invert')
5
+ return fn(collection)
6
+ }
7
+
8
+ const typeToFn = {
9
+ map: invert_map,
10
+ object: invert_obj,
11
+ }
12
+
13
+ function invert_map(coll) {
14
+ const res = new Map()
15
+ for (const [k, v] of coll.entries()) {
16
+ res.set(v, k)
17
+ }
18
+ return res
19
+ }
20
+
21
+ function invert_obj(coll) {
22
+ const res = {}
23
+
24
+ for (const [k, v] of Object.entries(coll)) res[v] = k
25
+
26
+ return res
27
+ }
28
+
29
+ module.exports = invert
@@ -0,0 +1,2 @@
1
+ import { default as invert } from '@common-fp/common-fp-types/invert'
2
+ export = invert
@@ -0,0 +1 @@
1
+ export { default } from '@common-fp/common-fp-types/invert'
@@ -0,0 +1,29 @@
1
+ import getFn from '@common-fp/shared-internals/get-fn'
2
+
3
+ const invert = collection => {
4
+ const fn = getFn(typeToFn, collection, 'collection', 'invert')
5
+ return fn(collection)
6
+ }
7
+
8
+ const typeToFn = {
9
+ map: invert_map,
10
+ object: invert_obj,
11
+ }
12
+
13
+ function invert_map(coll) {
14
+ const res = new Map()
15
+ for (const [k, v] of coll.entries()) {
16
+ res.set(v, k)
17
+ }
18
+ return res
19
+ }
20
+
21
+ function invert_obj(coll) {
22
+ const res = {}
23
+
24
+ for (const [k, v] of Object.entries(coll)) res[v] = k
25
+
26
+ return res
27
+ }
28
+
29
+ export default invert
@@ -0,0 +1,11 @@
1
+ const assertArgIsType = require('@common-fp/shared-internals/assert-arg-is-type')
2
+
3
+ const invokeWith =
4
+ (...args) =>
5
+ fn => {
6
+ assertArgIsType(fn, 'fn', 'function', 'invoke')
7
+
8
+ return fn(...args)
9
+ }
10
+
11
+ module.exports = invokeWith
@@ -0,0 +1,2 @@
1
+ import { default as invokeWith } from '@common-fp/common-fp-types/invoke-with'
2
+ export = invokeWith
@@ -0,0 +1 @@
1
+ export { default } from '@common-fp/common-fp-types/invoke-with'
@@ -0,0 +1,11 @@
1
+ import assertArgIsType from '@common-fp/shared-internals/assert-arg-is-type'
2
+
3
+ const invokeWith =
4
+ (...args) =>
5
+ fn => {
6
+ assertArgIsType(fn, 'fn', 'function', 'invoke')
7
+
8
+ return fn(...args)
9
+ }
10
+
11
+ export default invokeWith
@@ -0,0 +1,13 @@
1
+ const assertArgIsType = require('@common-fp/shared-internals/assert-arg-is-type')
2
+
3
+ const isAfter = date1 => {
4
+ assertArgIsType(date1, 'date1', 'date', 'isAfter')
5
+
6
+ return date2 => {
7
+ assertArgIsType(date2, 'date2', 'date', 'isAfter')
8
+
9
+ return date2 > date1
10
+ }
11
+ }
12
+
13
+ module.exports = isAfter
@@ -0,0 +1,2 @@
1
+ import { default as isAfter } from '@common-fp/common-fp-types/is-after'
2
+ export = isAfter
@@ -0,0 +1 @@
1
+ export { default } from '@common-fp/common-fp-types/is-after'
@@ -0,0 +1,13 @@
1
+ import assertArgIsType from '@common-fp/shared-internals/assert-arg-is-type'
2
+
3
+ const isAfter = date1 => {
4
+ assertArgIsType(date1, 'date1', 'date', 'isAfter')
5
+
6
+ return date2 => {
7
+ assertArgIsType(date2, 'date2', 'date', 'isAfter')
8
+
9
+ return date2 > date1
10
+ }
11
+ }
12
+
13
+ export default isAfter
@@ -0,0 +1,13 @@
1
+ const assertArgIsType = require('@common-fp/shared-internals/assert-arg-is-type')
2
+
3
+ const isAtOrAfter = date1 => {
4
+ assertArgIsType(date1, 'date1', 'date', 'isAtOrAfter')
5
+
6
+ return date2 => {
7
+ assertArgIsType(date2, 'date2', 'date', 'isAtOrAfter')
8
+
9
+ return date2 >= date1
10
+ }
11
+ }
12
+
13
+ module.exports = isAtOrAfter
@@ -0,0 +1,2 @@
1
+ import { default as isAtOrAfter } from '@common-fp/common-fp-types/is-at-or-after'
2
+ export = isAtOrAfter
@@ -0,0 +1 @@
1
+ export { default } from '@common-fp/common-fp-types/is-at-or-after'
@@ -0,0 +1,13 @@
1
+ import assertArgIsType from '@common-fp/shared-internals/assert-arg-is-type'
2
+
3
+ const isAtOrAfter = date1 => {
4
+ assertArgIsType(date1, 'date1', 'date', 'isAtOrAfter')
5
+
6
+ return date2 => {
7
+ assertArgIsType(date2, 'date2', 'date', 'isAtOrAfter')
8
+
9
+ return date2 >= date1
10
+ }
11
+ }
12
+
13
+ export default isAtOrAfter
@@ -0,0 +1,13 @@
1
+ const assertArgIsType = require('@common-fp/shared-internals/assert-arg-is-type')
2
+
3
+ const isAtOrBefore = date1 => {
4
+ assertArgIsType(date1, 'date1', 'date', 'isAtOrBefore')
5
+
6
+ return date2 => {
7
+ assertArgIsType(date2, 'date2', 'date', 'isAtOrBefore')
8
+
9
+ return date2 <= date1
10
+ }
11
+ }
12
+
13
+ module.exports = isAtOrBefore
@@ -0,0 +1,2 @@
1
+ import { default as isAtOrBefore } from '@common-fp/common-fp-types/is-at-or-before'
2
+ export = isAtOrBefore
@@ -0,0 +1 @@
1
+ export { default } from '@common-fp/common-fp-types/is-at-or-before'
@@ -0,0 +1,13 @@
1
+ import assertArgIsType from '@common-fp/shared-internals/assert-arg-is-type'
2
+
3
+ const isAtOrBefore = date1 => {
4
+ assertArgIsType(date1, 'date1', 'date', 'isAtOrBefore')
5
+
6
+ return date2 => {
7
+ assertArgIsType(date2, 'date2', 'date', 'isAtOrBefore')
8
+
9
+ return date2 <= date1
10
+ }
11
+ }
12
+
13
+ export default isAtOrBefore
@@ -0,0 +1,13 @@
1
+ const assertArgIsType = require('@common-fp/shared-internals/assert-arg-is-type')
2
+
3
+ const isBefore = date1 => {
4
+ assertArgIsType(date1, 'date1', 'date', 'isBefore')
5
+
6
+ return date2 => {
7
+ assertArgIsType(date2, 'date2', 'date', 'isBefore')
8
+
9
+ return date2 < date1
10
+ }
11
+ }
12
+
13
+ module.exports = isBefore
@@ -0,0 +1,2 @@
1
+ import { default as isBefore } from '@common-fp/common-fp-types/is-before'
2
+ export = isBefore
@@ -0,0 +1 @@
1
+ export { default } from '@common-fp/common-fp-types/is-before'
@@ -0,0 +1,13 @@
1
+ import assertArgIsType from '@common-fp/shared-internals/assert-arg-is-type'
2
+
3
+ const isBefore = date1 => {
4
+ assertArgIsType(date1, 'date1', 'date', 'isBefore')
5
+
6
+ return date2 => {
7
+ assertArgIsType(date2, 'date2', 'date', 'isBefore')
8
+
9
+ return date2 < date1
10
+ }
11
+ }
12
+
13
+ export default isBefore
@@ -0,0 +1,28 @@
1
+ const getFn = require('@common-fp/shared-internals/get-fn')
2
+
3
+ const isEmpty = collection => {
4
+ const fn = getFn(typeToFn, collection, 'collection', 'isEmpty')
5
+ return fn(collection)
6
+ }
7
+
8
+ const typeToFn = {
9
+ array: isEmpty_hasLength,
10
+ map: isEmpty_hasSize,
11
+ object: isEmpty_object,
12
+ set: isEmpty_hasSize,
13
+ string: isEmpty_hasLength,
14
+ }
15
+
16
+ function isEmpty_hasSize(coll) {
17
+ return coll.size === 0
18
+ }
19
+
20
+ function isEmpty_hasLength(coll) {
21
+ return coll.length === 0
22
+ }
23
+
24
+ function isEmpty_object(coll) {
25
+ return Object.keys(coll).length === 0
26
+ }
27
+
28
+ module.exports = isEmpty
@@ -0,0 +1,2 @@
1
+ import { default as isEmpty } from '@common-fp/common-fp-types/is-empty'
2
+ export = isEmpty
@@ -0,0 +1 @@
1
+ export { default } from '@common-fp/common-fp-types/is-empty'
@@ -0,0 +1,28 @@
1
+ import getFn from '@common-fp/shared-internals/get-fn'
2
+
3
+ const isEmpty = collection => {
4
+ const fn = getFn(typeToFn, collection, 'collection', 'isEmpty')
5
+ return fn(collection)
6
+ }
7
+
8
+ const typeToFn = {
9
+ array: isEmpty_hasLength,
10
+ map: isEmpty_hasSize,
11
+ object: isEmpty_object,
12
+ set: isEmpty_hasSize,
13
+ string: isEmpty_hasLength,
14
+ }
15
+
16
+ function isEmpty_hasSize(coll) {
17
+ return coll.size === 0
18
+ }
19
+
20
+ function isEmpty_hasLength(coll) {
21
+ return coll.length === 0
22
+ }
23
+
24
+ function isEmpty_object(coll) {
25
+ return Object.keys(coll).length === 0
26
+ }
27
+
28
+ export default isEmpty
@@ -0,0 +1,3 @@
1
+ const isFalsey = value => !value
2
+
3
+ module.exports = isFalsey