@asd14/m 7.5.1 → 7.6.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 (380) hide show
  1. package/README.md +31 -28
  2. package/dist/all/all.js +15 -21
  3. package/dist/all/all.js.map +1 -1
  4. package/dist/all/all.test.js +58 -36
  5. package/dist/all/all.test.js.map +1 -1
  6. package/dist/any/any.js +16 -22
  7. package/dist/any/any.js.map +1 -1
  8. package/dist/any/any.test.js +54 -33
  9. package/dist/any/any.test.js.map +1 -1
  10. package/dist/append/append.js +9 -11
  11. package/dist/append/append.js.map +1 -1
  12. package/dist/append/append.test.js +37 -7
  13. package/dist/append/append.test.js.map +1 -1
  14. package/dist/bottom/bottom.js +23 -29
  15. package/dist/bottom/bottom.js.map +1 -1
  16. package/dist/bottom/bottom.test.js +53 -14
  17. package/dist/bottom/bottom.test.js.map +1 -1
  18. package/dist/cases/cases.js +5 -13
  19. package/dist/cases/cases.js.map +1 -1
  20. package/dist/cases/cases.test.js +67 -35
  21. package/dist/cases/cases.test.js.map +1 -1
  22. package/dist/clone/clone.js +21 -30
  23. package/dist/clone/clone.js.map +1 -1
  24. package/dist/clone/clone.test.js +38 -37
  25. package/dist/clone/clone.test.js.map +1 -1
  26. package/dist/compact/compact.js +39 -39
  27. package/dist/compact/compact.js.map +1 -1
  28. package/dist/compact/compact.test.js +83 -43
  29. package/dist/compact/compact.test.js.map +1 -1
  30. package/dist/contains/contains.js +6 -10
  31. package/dist/contains/contains.js.map +1 -1
  32. package/dist/contains/contains.test.js +7 -6
  33. package/dist/contains/contains.test.js.map +1 -1
  34. package/dist/converge/converge.js +34 -37
  35. package/dist/converge/converge.js.map +1 -1
  36. package/dist/converge/converge.test.js +62 -25
  37. package/dist/converge/converge.test.js.map +1 -1
  38. package/dist/count/count.js +36 -51
  39. package/dist/count/count.js.map +1 -1
  40. package/dist/count/count.test.js +97 -67
  41. package/dist/count/count.test.js.map +1 -1
  42. package/dist/curry/curry.js +20 -18
  43. package/dist/curry/curry.js.map +1 -1
  44. package/dist/curry/curry.test.js +8 -9
  45. package/dist/curry/curry.test.js.map +1 -1
  46. package/dist/debounce/debounce.js +15 -19
  47. package/dist/debounce/debounce.js.map +1 -1
  48. package/dist/debounce/debounce.test.js +43 -46
  49. package/dist/debounce/debounce.test.js.map +1 -1
  50. package/dist/dec/dec.js +3 -3
  51. package/dist/dec/dec.js.map +1 -1
  52. package/dist/dec/dec.test.js +4 -3
  53. package/dist/dec/dec.test.js.map +1 -1
  54. package/dist/deep-equal/deep-equal.bench.js +100 -64
  55. package/dist/deep-equal/deep-equal.bench.js.map +1 -1
  56. package/dist/deep-equal/deep-equal.js +14 -16
  57. package/dist/deep-equal/deep-equal.js.map +1 -1
  58. package/dist/deep-equal/deep-equal.own.js +57 -78
  59. package/dist/deep-equal/deep-equal.own.js.map +1 -1
  60. package/dist/deep-equal/deep-equal.test.js +127 -82
  61. package/dist/deep-equal/deep-equal.test.js.map +1 -1
  62. package/dist/distinct/distinct.bench.js +46 -31
  63. package/dist/distinct/distinct.bench.js.map +1 -1
  64. package/dist/distinct/distinct.js +15 -24
  65. package/dist/distinct/distinct.js.map +1 -1
  66. package/dist/distinct/distinct.test.js +37 -14
  67. package/dist/distinct/distinct.test.js.map +1 -1
  68. package/dist/drop-last/drop-last.js +8 -12
  69. package/dist/drop-last/drop-last.js.map +1 -1
  70. package/dist/drop-last/drop-last.test.js +34 -8
  71. package/dist/drop-last/drop-last.test.js.map +1 -1
  72. package/dist/elapsed-time/elapsed-time.js +17 -18
  73. package/dist/elapsed-time/elapsed-time.js.map +1 -1
  74. package/dist/elapsed-time/elapsed-time.test.js +9 -8
  75. package/dist/elapsed-time/elapsed-time.test.js.map +1 -1
  76. package/dist/ends-with/ends-with.js +10 -16
  77. package/dist/ends-with/ends-with.js.map +1 -1
  78. package/dist/ends-with/ends-with.test.js +8 -7
  79. package/dist/ends-with/ends-with.test.js.map +1 -1
  80. package/dist/escape/escape.js +3 -4
  81. package/dist/escape/escape.js.map +1 -1
  82. package/dist/escape-html/escape-html.js +12 -11
  83. package/dist/escape-html/escape-html.js.map +1 -1
  84. package/dist/escape-html/escape-html.test.js +6 -5
  85. package/dist/escape-html/escape-html.test.js.map +1 -1
  86. package/dist/escape-reg-exp/escape-reg-exp.js +1 -2
  87. package/dist/escape-reg-exp/escape-reg-exp.js.map +1 -1
  88. package/dist/escape-reg-exp/escape-reg-exp.test.js +9 -8
  89. package/dist/escape-reg-exp/escape-reg-exp.test.js.map +1 -1
  90. package/dist/filter/filter.js +16 -21
  91. package/dist/filter/filter.js.map +1 -1
  92. package/dist/filter/filter.test.js +94 -57
  93. package/dist/filter/filter.test.js.map +1 -1
  94. package/dist/find/find.js +38 -50
  95. package/dist/find/find.js.map +1 -1
  96. package/dist/find/find.test.js +73 -64
  97. package/dist/find/find.test.js.map +1 -1
  98. package/dist/find-index/find-index.js +16 -20
  99. package/dist/find-index/find-index.js.map +1 -1
  100. package/dist/find-index/find-index.test.js +48 -38
  101. package/dist/find-index/find-index.test.js.map +1 -1
  102. package/dist/first/first.js +3 -3
  103. package/dist/first/first.js.map +1 -1
  104. package/dist/first/first.test.js +13 -8
  105. package/dist/first/first.test.js.map +1 -1
  106. package/dist/flatten/flatten.js +19 -34
  107. package/dist/flatten/flatten.js.map +1 -1
  108. package/dist/flatten/flatten.test.js +59 -24
  109. package/dist/flatten/flatten.test.js.map +1 -1
  110. package/dist/for-each/for-each.js +10 -12
  111. package/dist/for-each/for-each.js.map +1 -1
  112. package/dist/for-each/for-each.test.js +36 -16
  113. package/dist/for-each/for-each.test.js.map +1 -1
  114. package/dist/group-by/group-by.js +13 -17
  115. package/dist/group-by/group-by.js.map +1 -1
  116. package/dist/group-by/group-by.test.js +83 -49
  117. package/dist/group-by/group-by.test.js.map +1 -1
  118. package/dist/gt/gt.js +3 -6
  119. package/dist/gt/gt.js.map +1 -1
  120. package/dist/gt/gt.test.js +7 -6
  121. package/dist/gt/gt.test.js.map +1 -1
  122. package/dist/has-key/has-key.js +3 -4
  123. package/dist/has-key/has-key.js.map +1 -1
  124. package/dist/has-key/has-key.test.js +10 -9
  125. package/dist/has-key/has-key.test.js.map +1 -1
  126. package/dist/hist/hist.js +22 -34
  127. package/dist/hist/hist.js.map +1 -1
  128. package/dist/hist/hist.test.js +43 -28
  129. package/dist/hist/hist.test.js.map +1 -1
  130. package/dist/i/i.js +3 -3
  131. package/dist/i/i.js.map +1 -1
  132. package/dist/i/i.test.js +17 -12
  133. package/dist/i/i.test.js.map +1 -1
  134. package/dist/inc/inc.js +3 -3
  135. package/dist/inc/inc.js.map +1 -1
  136. package/dist/inc/inc.test.js +4 -3
  137. package/dist/inc/inc.test.js.map +1 -1
  138. package/dist/index-by/index-by.js +12 -17
  139. package/dist/index-by/index-by.js.map +1 -1
  140. package/dist/index-by/index-by.test.js +44 -36
  141. package/dist/index-by/index-by.test.js.map +1 -1
  142. package/dist/index.js +13 -12
  143. package/dist/index.js.map +1 -1
  144. package/dist/index.test.js +7 -7
  145. package/dist/index.test.js.map +1 -1
  146. package/dist/intersect/intersect.js +41 -54
  147. package/dist/intersect/intersect.js.map +1 -1
  148. package/dist/intersect/intersect.test.js +74 -38
  149. package/dist/intersect/intersect.test.js.map +1 -1
  150. package/dist/is/is.js +13 -20
  151. package/dist/is/is.js.map +1 -1
  152. package/dist/is/is.test.js +25 -25
  153. package/dist/is/is.test.js.map +1 -1
  154. package/dist/is-between/is-between.js +9 -13
  155. package/dist/is-between/is-between.js.map +1 -1
  156. package/dist/is-between/is-between.test.js +14 -13
  157. package/dist/is-between/is-between.test.js.map +1 -1
  158. package/dist/is-empty/is-empty.js +23 -44
  159. package/dist/is-empty/is-empty.js.map +1 -1
  160. package/dist/is-empty/is-empty.test.js +31 -27
  161. package/dist/is-empty/is-empty.test.js.map +1 -1
  162. package/dist/is-equal/is-equal.js +3 -6
  163. package/dist/is-equal/is-equal.js.map +1 -1
  164. package/dist/is-equal/is-equal.test.js +19 -15
  165. package/dist/is-equal/is-equal.test.js.map +1 -1
  166. package/dist/is-match/is-match.js +16 -25
  167. package/dist/is-match/is-match.js.map +1 -1
  168. package/dist/is-match/is-match.test.js +67 -64
  169. package/dist/is-match/is-match.test.js.map +1 -1
  170. package/dist/is-uri/is-uri.js +3 -4
  171. package/dist/is-uri/is-uri.js.map +1 -1
  172. package/dist/is-uri/is-uri.test.js +13 -13
  173. package/dist/is-uri/is-uri.test.js.map +1 -1
  174. package/dist/join/join.js +42 -53
  175. package/dist/join/join.js.map +1 -1
  176. package/dist/join/join.test.js +94 -40
  177. package/dist/join/join.test.js.map +1 -1
  178. package/dist/keys/keys.js +34 -24
  179. package/dist/keys/keys.js.map +1 -1
  180. package/dist/keys/keys.test.js +21 -9
  181. package/dist/keys/keys.test.js.map +1 -1
  182. package/dist/last/last.js +3 -4
  183. package/dist/last/last.js.map +1 -1
  184. package/dist/last/last.test.js +14 -7
  185. package/dist/last/last.test.js.map +1 -1
  186. package/dist/lt/lt.js +3 -4
  187. package/dist/lt/lt.js.map +1 -1
  188. package/dist/lt/lt.test.js +6 -5
  189. package/dist/lt/lt.test.js.map +1 -1
  190. package/dist/map/map.js +12 -15
  191. package/dist/map/map.js.map +1 -1
  192. package/dist/map/map.test.js +61 -21
  193. package/dist/map/map.test.js.map +1 -1
  194. package/dist/map-matrix/map-matrix.js +12 -19
  195. package/dist/map-matrix/map-matrix.js.map +1 -1
  196. package/dist/map-matrix/map-matrix.test.js +76 -16
  197. package/dist/map-matrix/map-matrix.test.js.map +1 -1
  198. package/dist/max/max.js +27 -39
  199. package/dist/max/max.js.map +1 -1
  200. package/dist/max/max.test.js +43 -23
  201. package/dist/max/max.test.js.map +1 -1
  202. package/dist/merge/merge.js +53 -63
  203. package/dist/merge/merge.js.map +1 -1
  204. package/dist/merge/merge.test.js +57 -49
  205. package/dist/merge/merge.test.js.map +1 -1
  206. package/dist/min/min.js +27 -39
  207. package/dist/min/min.js.map +1 -1
  208. package/dist/min/min.test.js +38 -22
  209. package/dist/min/min.test.js.map +1 -1
  210. package/dist/move/move.js +23 -37
  211. package/dist/move/move.js.map +1 -1
  212. package/dist/move/move.test.js +58 -15
  213. package/dist/move/move.test.js.map +1 -1
  214. package/dist/mutate/mutate.js +76 -84
  215. package/dist/mutate/mutate.js.map +1 -1
  216. package/dist/mutate/mutate.test.js +107 -89
  217. package/dist/mutate/mutate.test.js.map +1 -1
  218. package/dist/page/page.js +7 -14
  219. package/dist/page/page.js.map +1 -1
  220. package/dist/page/page.test.js +66 -15
  221. package/dist/page/page.test.js.map +1 -1
  222. package/dist/partition/partition.js +20 -26
  223. package/dist/partition/partition.js.map +1 -1
  224. package/dist/partition/partition.test.js +96 -35
  225. package/dist/partition/partition.test.js.map +1 -1
  226. package/dist/pick/pick.js +20 -26
  227. package/dist/pick/pick.js.map +1 -1
  228. package/dist/pick/pick.test.js +22 -12
  229. package/dist/pick/pick.test.js.map +1 -1
  230. package/dist/pipe/pipe.js +15 -14
  231. package/dist/pipe/pipe.js.map +1 -1
  232. package/dist/pipe/pipe.test.js +9 -11
  233. package/dist/pipe/pipe.test.js.map +1 -1
  234. package/dist/pipe-p/pipe-p.js +18 -21
  235. package/dist/pipe-p/pipe-p.js.map +1 -1
  236. package/dist/pipe-p/pipe-p.test.js +21 -24
  237. package/dist/pipe-p/pipe-p.test.js.map +1 -1
  238. package/dist/pluck/pluck.js +27 -38
  239. package/dist/pluck/pluck.js.map +1 -1
  240. package/dist/pluck/pluck.test.js +57 -37
  241. package/dist/pluck/pluck.test.js.map +1 -1
  242. package/dist/prepend/prepend.js +9 -11
  243. package/dist/prepend/prepend.js.map +1 -1
  244. package/dist/prepend/prepend.test.js +37 -7
  245. package/dist/prepend/prepend.test.js.map +1 -1
  246. package/dist/proto-chain/proto-chain.js +8 -8
  247. package/dist/proto-chain/proto-chain.js.map +1 -1
  248. package/dist/proto-chain/proto-chain.test.js +21 -20
  249. package/dist/proto-chain/proto-chain.test.js.map +1 -1
  250. package/dist/push/push.js +9 -12
  251. package/dist/push/push.js.map +1 -1
  252. package/dist/push/push.test.js +19 -8
  253. package/dist/push/push.test.js.map +1 -1
  254. package/dist/raise/raise.js +3 -3
  255. package/dist/raise/raise.js.map +1 -1
  256. package/dist/raise/raise.test.js +6 -5
  257. package/dist/raise/raise.test.js.map +1 -1
  258. package/dist/random/random.js +4 -5
  259. package/dist/random/random.js.map +1 -1
  260. package/dist/random/random.test.js +11 -12
  261. package/dist/random/random.test.js.map +1 -1
  262. package/dist/read/read.js +41 -48
  263. package/dist/read/read.js.map +1 -1
  264. package/dist/read/read.test.js +106 -60
  265. package/dist/read/read.test.js.map +1 -1
  266. package/dist/reduce/reduce.js +24 -29
  267. package/dist/reduce/reduce.js.map +1 -1
  268. package/dist/reduce/reduce.test.js +43 -32
  269. package/dist/reduce/reduce.test.js.map +1 -1
  270. package/dist/remove/remove.js +39 -50
  271. package/dist/remove/remove.js.map +1 -1
  272. package/dist/remove/remove.test.js +92 -54
  273. package/dist/remove/remove.test.js.map +1 -1
  274. package/dist/rename/rename.js +40 -63
  275. package/dist/rename/rename.js.map +1 -1
  276. package/dist/rename/rename.test.js +45 -39
  277. package/dist/rename/rename.test.js.map +1 -1
  278. package/dist/rename-file/rename-file.js +6 -11
  279. package/dist/rename-file/rename-file.js.map +1 -1
  280. package/dist/rename-file/rename-file.test.js +9 -8
  281. package/dist/rename-file/rename-file.test.js.map +1 -1
  282. package/dist/repeat/repeat.js +23 -30
  283. package/dist/repeat/repeat.js.map +1 -1
  284. package/dist/repeat/repeat.test.js +28 -11
  285. package/dist/repeat/repeat.test.js.map +1 -1
  286. package/dist/replace/replace.js +29 -42
  287. package/dist/replace/replace.js.map +1 -1
  288. package/dist/replace/replace.test.js +127 -82
  289. package/dist/replace/replace.test.js.map +1 -1
  290. package/dist/same/same.js +5 -5
  291. package/dist/same/same.js.map +1 -1
  292. package/dist/same/same.test.js +5 -4
  293. package/dist/same/same.test.js.map +1 -1
  294. package/dist/sequence/sequence.js +31 -40
  295. package/dist/sequence/sequence.js.map +1 -1
  296. package/dist/sequence/sequence.test.js +132 -80
  297. package/dist/sequence/sequence.test.js.map +1 -1
  298. package/dist/sort/sort-with.js +90 -98
  299. package/dist/sort/sort-with.js.map +1 -1
  300. package/dist/sort/sort.js +24 -32
  301. package/dist/sort/sort.js.map +1 -1
  302. package/dist/sort/sort.test.js +407 -294
  303. package/dist/sort/sort.test.js.map +1 -1
  304. package/dist/split/split.js +22 -29
  305. package/dist/split/split.js.map +1 -1
  306. package/dist/split/split.test.js +29 -12
  307. package/dist/split/split.test.js.map +1 -1
  308. package/dist/split-in-groups-of/split-in-groups-of.js +29 -38
  309. package/dist/split-in-groups-of/split-in-groups-of.js.map +1 -1
  310. package/dist/split-in-groups-of/split-in-groups-of.test.js +84 -15
  311. package/dist/split-in-groups-of/split-in-groups-of.test.js.map +1 -1
  312. package/dist/spy/spy.js +19 -22
  313. package/dist/spy/spy.js.map +1 -1
  314. package/dist/spy/spy.test.js +32 -28
  315. package/dist/spy/spy.test.js.map +1 -1
  316. package/dist/starts-with/starts-with.js +7 -12
  317. package/dist/starts-with/starts-with.js.map +1 -1
  318. package/dist/starts-with/starts-with.test.js +12 -8
  319. package/dist/starts-with/starts-with.test.js.map +1 -1
  320. package/dist/throttle/throttle.js +24 -31
  321. package/dist/throttle/throttle.js.map +1 -1
  322. package/dist/throttle/throttle.test.js +35 -37
  323. package/dist/throttle/throttle.test.js.map +1 -1
  324. package/dist/to-lower/to-lower.js +3 -3
  325. package/dist/to-lower/to-lower.js.map +1 -1
  326. package/dist/to-lower/to-lower.test.js +5 -4
  327. package/dist/to-lower/to-lower.test.js.map +1 -1
  328. package/dist/to-upper/to-upper.js +3 -3
  329. package/dist/to-upper/to-upper.js.map +1 -1
  330. package/dist/to-upper/to-upper.test.js +5 -4
  331. package/dist/to-upper/to-upper.test.js.map +1 -1
  332. package/dist/toggle/toggle.js +9 -11
  333. package/dist/toggle/toggle.js.map +1 -1
  334. package/dist/toggle/toggle.test.js +24 -5
  335. package/dist/toggle/toggle.test.js.map +1 -1
  336. package/dist/top/top.js +23 -35
  337. package/dist/top/top.js.map +1 -1
  338. package/dist/top/top.test.js +47 -13
  339. package/dist/top/top.test.js.map +1 -1
  340. package/dist/trim/trim.js +19 -26
  341. package/dist/trim/trim.js.map +1 -1
  342. package/dist/trim/trim.test.js +6 -5
  343. package/dist/trim/trim.test.js.map +1 -1
  344. package/dist/try-catch/try-catch.js +15 -14
  345. package/dist/try-catch/try-catch.js.map +1 -1
  346. package/dist/try-catch/try-catch.test.js +9 -8
  347. package/dist/try-catch/try-catch.test.js.map +1 -1
  348. package/dist/type/type.js +3 -4
  349. package/dist/type/type.js.map +1 -1
  350. package/dist/type/type.test.js +16 -16
  351. package/dist/type/type.test.js.map +1 -1
  352. package/dist/unite/unite.js +3 -6
  353. package/dist/unite/unite.js.map +1 -1
  354. package/dist/unite/unite.test.js +8 -3
  355. package/dist/unite/unite.test.js.map +1 -1
  356. package/dist/update/update.js +74 -81
  357. package/dist/update/update.js.map +1 -1
  358. package/dist/update/update.test.js +92 -79
  359. package/dist/update/update.test.js.map +1 -1
  360. package/dist/upsert/upsert.js +14 -18
  361. package/dist/upsert/upsert.js.map +1 -1
  362. package/dist/upsert/upsert.test.js +57 -42
  363. package/dist/upsert/upsert.test.js.map +1 -1
  364. package/dist/values/values.js +38 -29
  365. package/dist/values/values.js.map +1 -1
  366. package/dist/values/values.test.js +21 -9
  367. package/dist/values/values.test.js.map +1 -1
  368. package/dist/when/when.js +27 -37
  369. package/dist/when/when.js.map +1 -1
  370. package/dist/when/when.test.js +23 -15
  371. package/dist/when/when.test.js.map +1 -1
  372. package/dist/write/write.js +6 -12
  373. package/dist/write/write.js.map +1 -1
  374. package/dist/write/write.test.js +14 -13
  375. package/dist/write/write.test.js.map +1 -1
  376. package/dist/zip-to-object/zip-to-object.js +8 -11
  377. package/dist/zip-to-object/zip-to-object.js.map +1 -1
  378. package/dist/zip-to-object/zip-to-object.test.js +29 -12
  379. package/dist/zip-to-object/zip-to-object.test.js.map +1 -1
  380. package/package.json +41 -38
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/trim/trim.js"],"names":["escapeRegExp","_trim","char","input","safeChar","replace","RegExp","trim","params","length"],"mappings":"AAAA;AAEA,SAASA,YAAT,QAA6B,qCAA7B;;AAEA,IAAMC,KAAK,GAAG,SAARA,KAAQ,GAAuB;AAAA,MAAtBC,IAAsB,uEAAf,GAAe;AAAA,MAAVC,KAAU;AACnC,MAAMC,QAAQ,GAAGJ,YAAY,CAACE,IAAD,CAA7B;AAEA,SAAOC,KAAK,CAACE,OAAN,CAAc,IAAIC,MAAJ,aAAgBF,QAAhB,iBAA+BA,QAA/B,UAA8C,GAA9C,CAAd,EAAkE,EAAlE,CAAP;AACD,CAJD;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,IAAMG,IAAI,GAAG,SAAPA,IAAO,GAAe;AAAA,oCAAXC,MAAW;AAAXA,IAAAA,MAAW;AAAA;;AAC1B;AACA,MAAIA,MAAM,CAACC,MAAP,IAAiB,CAArB,EAAwB;AACtB,WAAO,UAAAN,KAAK;AAAA,aAAIF,KAAK,CAACO,MAAM,CAAC,CAAD,CAAP,EAAYL,KAAZ,CAAT;AAAA,KAAZ;AACD,GAJyB,CAM1B;;;AACA,SAAOF,KAAK,MAAL,SAASO,MAAT,CAAP;AACD,CARD;;AAUA,SAASD,IAAT","sourcesContent":["/* eslint-disable jsdoc/check-param-names,jsdoc/require-param */\n\nimport { escapeRegExp } from \"../escape-reg-exp/escape-reg-exp.js\"\n\nconst _trim = (char = \" \", input) => {\n const safeChar = escapeRegExp(char)\n\n return input.replace(new RegExp(`^[${safeChar}]+|[${safeChar}]+$`, \"g\"), \"\")\n}\n\n/**\n * Remove char from beginning and end of string\n *\n * @param {string} char Character to be removed\n * @param {string} source Source string\n *\n * @returns {string}\n *\n * @tag String\n * @signature (char: string) => (source: string): string\n * @signature (char: string, source: string): string\n *\n * @example\n * trim()(\" lorem \")\n * // => \"lorem\"\n *\n * trim(\"-\", \"-- lorem -\")\n * // => \" lorem \"\n */\nconst trim = (...params) => {\n // @signature (char) => (source)\n if (params.length <= 1) {\n return input => _trim(params[0], input)\n }\n\n // @signature (char, source)\n return _trim(...params)\n}\n\nexport { trim }\n"],"file":"trim.js"}
1
+ {"version":3,"sources":["../../src/trim/trim.js"],"sourcesContent":["/* eslint-disable jsdoc/check-param-names,jsdoc/require-param */\n\nimport { escapeRegExp } from \"../escape-reg-exp/escape-reg-exp.js\"\n\nconst _trim = (char = \" \", input) => {\n const safeChar = escapeRegExp(char)\n\n return input.replace(new RegExp(`^[${safeChar}]+|[${safeChar}]+$`, \"g\"), \"\")\n}\n\n/**\n * Remove char from beginning and end of string\n *\n * @param {string} char Character to be removed\n * @param {string} source Source string\n *\n * @returns {string}\n *\n * @tag String\n * @signature (char: string) => (source: string): string\n * @signature (char: string, source: string): string\n *\n * @example\n * trim()(\" lorem \")\n * // => \"lorem\"\n *\n * trim(\"-\", \"-- lorem -\")\n * // => \" lorem \"\n */\nconst trim = (...params) => {\n // @signature (char) => (source)\n if (params.length <= 1) {\n return input => _trim(params[0], input)\n }\n\n // @signature (char, source)\n return _trim(...params)\n}\n\nexport { trim }\n"],"names":["escapeRegExp","_trim","char","input","safeChar","replace","RegExp","trim","params","length"],"mappings":";AAAA,EAAgE,AAAhE,4DAAgE,AAAhE,EAAgE,CAEhE,MAAM,GAAGA,YAAY,QAAQ,CAAqC;AAElE,GAAK,CAACC,KAAK,GAAG,QAAQ,GAAe,CAAC;QAAvBC,IAAI,oEAAG,CAAG,IAAEC,KAAK;IAC9B,GAAK,CAACC,QAAQ,GAAGJ,YAAY,CAACE,IAAI;IAElC,MAAM,CAACC,KAAK,CAACE,OAAO,CAAC,GAAG,CAACC,MAAM,CAAE,CAAE,IAAiBF,MAAQ,CAAvBA,QAAQ,EAAC,CAAI,OAAW,MAAG,CAAZA,QAAQ,EAAC,CAAG,OAAG,CAAG,KAAG,CAAE;AAC7E,CAAC;AAED,EAkBG,AAlBH;;;;;;;;;;;;;;;;;;CAkBG,AAlBH,EAkBG,CACH,GAAK,CAACG,IAAI,GAAG,QAAQ,GAAO,CAAC;qCAAZC,MAAM;QAANA,MAAM;;IACrB,EAAgC,AAAhC,8BAAgC;IAChC,EAAE,EAAEA,MAAM,CAACC,MAAM,IAAI,CAAC,EAAE,CAAC;QACvB,MAAM,CAACN,QAAQ,CAARA,KAAK;YAAIF,MAAMO,CAANP,KAAK,CAACO,MAAM,CAAC,CAAC,GAAGL,KAAK;;IACxC,CAAC;IAED,EAA4B,AAA5B,0BAA4B;IAC5B,MAAM,CAACF,KAAK,CAALA,KAAgB,CAAhBA,IAAI,CAAJA,CAAK,+BAAIO,MAAM;AACxB,CAAC;AAED,MAAM,GAAGD,IAAI"}
@@ -1,9 +1,10 @@
1
1
  import test from "tape";
2
2
  import { trim } from "./trim.js";
3
- test("trim", function (t) {
4
- t.equals(trim()(" lorem "), "lorem", "Remove white space - curried");
5
- t.equals(trim(" ", " lorem "), "lorem", "Remove white space - uncurried");
6
- t.equals(trim("-")("-- lorem -"), " lorem ", "Remove custom char");
7
- t.end();
3
+ test("trim", function(t) {
4
+ t.equals(trim()(" lorem "), "lorem", "Remove white space - curried");
5
+ t.equals(trim(" ", " lorem "), "lorem", "Remove white space - uncurried");
6
+ t.equals(trim("-")("-- lorem -"), " lorem ", "Remove custom char");
7
+ t.end();
8
8
  });
9
+
9
10
  //# sourceMappingURL=trim.test.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/trim/trim.test.js"],"names":["test","trim","t","equals","end"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,MAAjB;AAEA,SAASC,IAAT,QAAqB,WAArB;AAEAD,IAAI,CAAC,MAAD,EAAS,UAAAE,CAAC,EAAI;AAChBA,EAAAA,CAAC,CAACC,MAAF,CAASF,IAAI,GAAG,UAAH,CAAb,EAA6B,OAA7B,EAAsC,8BAAtC;AAEAC,EAAAA,CAAC,CAACC,MAAF,CAASF,IAAI,CAAC,GAAD,EAAM,UAAN,CAAb,EAAgC,OAAhC,EAAyC,gCAAzC;AAEAC,EAAAA,CAAC,CAACC,MAAF,CAASF,IAAI,CAAC,GAAD,CAAJ,CAAU,aAAV,CAAT,EAAmC,UAAnC,EAA+C,oBAA/C;AAEAC,EAAAA,CAAC,CAACE,GAAF;AACD,CARG,CAAJ","sourcesContent":["import test from \"tape\"\n\nimport { trim } from \"./trim.js\"\n\ntest(\"trim\", t => {\n t.equals(trim()(\" lorem \"), \"lorem\", \"Remove white space - curried\")\n\n t.equals(trim(\" \", \" lorem \"), \"lorem\", \"Remove white space - uncurried\")\n\n t.equals(trim(\"-\")(\"-- lorem -\"), \" lorem \", \"Remove custom char\")\n\n t.end()\n})\n"],"file":"trim.test.js"}
1
+ {"version":3,"sources":["../../src/trim/trim.test.js"],"sourcesContent":["import test from \"tape\"\n\nimport { trim } from \"./trim.js\"\n\ntest(\"trim\", t => {\n t.equals(trim()(\" lorem \"), \"lorem\", \"Remove white space - curried\")\n\n t.equals(trim(\" \", \" lorem \"), \"lorem\", \"Remove white space - uncurried\")\n\n t.equals(trim(\"-\")(\"-- lorem -\"), \" lorem \", \"Remove custom char\")\n\n t.end()\n})\n"],"names":["test","trim","t","equals","end"],"mappings":"AAAA,MAAM,CAACA,IAAI,MAAM,CAAM;AAEvB,MAAM,GAAGC,IAAI,QAAQ,CAAW;AAEhCD,IAAI,CAAC,CAAM,OAAEE,QACZ,CADYA,CAAC,EAAI,CAAC;IACjBA,CAAC,CAACC,MAAM,CAACF,IAAI,GAAG,CAAU,YAAG,CAAO,QAAE,CAA8B;IAEpEC,CAAC,CAACC,MAAM,CAACF,IAAI,CAAC,CAAG,IAAE,CAAU,YAAG,CAAO,QAAE,CAAgC;IAEzEC,CAAC,CAACC,MAAM,CAACF,IAAI,CAAC,CAAG,IAAE,CAAa,eAAG,CAAU,WAAE,CAAoB;IAEnEC,CAAC,CAACE,GAAG;AACP,CAAC"}
@@ -1,3 +1,4 @@
1
+ import * as swcHelpers from "@swc/helpers";
1
2
  /**
2
3
  * Replicate try/catch using a tryer and catcher function
3
4
  *
@@ -17,20 +18,20 @@
17
18
  * (error, source) => inc(source)
18
19
  * )(10)
19
20
  * // => 11
20
- */
21
- var tryCatch = function tryCatch(tryer, catcher) {
22
- return function () {
23
- for (var _len = arguments.length, input = new Array(_len), _key = 0; _key < _len; _key++) {
24
- input[_key] = arguments[_key];
25
- }
26
-
27
- try {
28
- return tryer.apply(void 0, input);
29
- } catch (error) {
30
- return catcher.apply(void 0, [error].concat(input));
31
- }
32
- };
21
+ */ var tryCatch = function(tryer, catcher) {
22
+ return function() {
23
+ for(var _len = arguments.length, input = new Array(_len), _key = 0; _key < _len; _key++){
24
+ input[_key] = arguments[_key];
25
+ }
26
+ try {
27
+ return tryer.apply(void 0, swcHelpers.toConsumableArray(input));
28
+ } catch (error) {
29
+ return catcher.apply(void 0, [
30
+ error
31
+ ].concat(swcHelpers.toConsumableArray(input)));
32
+ }
33
+ };
33
34
  };
34
-
35
35
  export { tryCatch };
36
+
36
37
  //# sourceMappingURL=try-catch.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/try-catch/try-catch.js"],"names":["tryCatch","tryer","catcher","input","error"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,QAAQ,GACZ,SADIA,QACJ,CAACC,KAAD,EAAQC,OAAR;AAAA,SACA,YAAc;AAAA,sCAAVC,KAAU;AAAVA,MAAAA,KAAU;AAAA;;AACZ,QAAI;AACF,aAAOF,KAAK,MAAL,SAASE,KAAT,CAAP;AACD,KAFD,CAEE,OAAOC,KAAP,EAAc;AACd,aAAOF,OAAO,MAAP,UAAQE,KAAR,SAAkBD,KAAlB,EAAP;AACD;AACF,GAPD;AAAA,CADF;;AAUA,SAASH,QAAT","sourcesContent":["/**\n * Replicate try/catch using a tryer and catcher function\n *\n * @param {Function} tryer Try to do something with source input\n * @param {Function} catcher Run if tryer throws exception\n *\n * @returns {any}\n *\n * @tag Core\n *\n * @example\n * tryCatch(inc)(10)\n * // => 11\n *\n * tryCatch(\n * () => { throw new Error(\"Tryer error\") },\n * (error, source) => inc(source)\n * )(10)\n * // => 11\n */\nconst tryCatch =\n (tryer, catcher) =>\n (...input) => {\n try {\n return tryer(...input)\n } catch (error) {\n return catcher(error, ...input)\n }\n }\n\nexport { tryCatch }\n"],"file":"try-catch.js"}
1
+ {"version":3,"sources":["../../src/try-catch/try-catch.js"],"sourcesContent":["/**\n * Replicate try/catch using a tryer and catcher function\n *\n * @param {Function} tryer Try to do something with source input\n * @param {Function} catcher Run if tryer throws exception\n *\n * @returns {any}\n *\n * @tag Core\n *\n * @example\n * tryCatch(inc)(10)\n * // => 11\n *\n * tryCatch(\n * () => { throw new Error(\"Tryer error\") },\n * (error, source) => inc(source)\n * )(10)\n * // => 11\n */\nconst tryCatch =\n (tryer, catcher) =>\n (...input) => {\n try {\n return tryer(...input)\n } catch (error) {\n return catcher(error, ...input)\n }\n }\n\nexport { tryCatch }\n"],"names":["tryCatch","catcher","tryer","input","error"],"mappings":";AAAA,EAmBG,AAnBH;;;;;;;;;;;;;;;;;;;CAmBG,AAnBH,EAmBG,CACH,GAAK,CAACA,QAAQ,GACZ,QAAQC,CAAPC,KAAK,EAAED,OAAO;IACf,MAAM,CAAN,QAAQ,GAAM,CAAC;yCAAXE,KAAK;YAALA,KAAK;;QACP,GAAG,CAAC,CAAC;YACH,MAAM,CAACD,KAAK,CAALA,KAAe,CAAfA,IAAI,CAAJA,CAAK,+BAAIC,KAAK;QACvB,CAAC,CAAC,KAAK,EAAEC,KAAK,EAAE,CAAC;YACf,MAAM,CAACH,OAAO,CAAPA,KAAwB,CAAxBA,IAAI,CAAJA,CAAO,EAAPA,CAAC;gBAAOG,KAAK;YAAU,CAAC,CAAxBH,MAAwB,8BAANE,KAAK;QAChC,CAAC;IACH,CAAC;;AAEH,MAAM,GAAGH,QAAQ"}
@@ -1,13 +1,14 @@
1
1
  import test from "tape";
2
2
  import { inc } from "../inc/inc.js";
3
3
  import { tryCatch } from "./try-catch.js";
4
- test("tryCatch", function (t) {
5
- t.equals(tryCatch(inc)(10), 11, "Given tryer function not throwing, apply tryer function on input");
6
- t.equals(tryCatch(function () {
7
- throw new Error("Tryer error");
8
- }, function (error, input) {
9
- return inc(input);
10
- })(10), 11, "Given tryer function throwing, apply catcher function on input");
11
- t.end();
4
+ test("tryCatch", function(t) {
5
+ t.equals(tryCatch(inc)(10), 11, "Given tryer function not throwing, apply tryer function on input");
6
+ t.equals(tryCatch(function() {
7
+ throw new Error("Tryer error");
8
+ }, function(error, input) {
9
+ return inc(input);
10
+ })(10), 11, "Given tryer function throwing, apply catcher function on input");
11
+ t.end();
12
12
  });
13
+
13
14
  //# sourceMappingURL=try-catch.test.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/try-catch/try-catch.test.js"],"names":["test","inc","tryCatch","t","equals","Error","error","input","end"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,MAAjB;AAEA,SAASC,GAAT,QAAoB,eAApB;AACA,SAASC,QAAT,QAAyB,gBAAzB;AAEAF,IAAI,CAAC,UAAD,EAAa,UAAAG,CAAC,EAAI;AACpBA,EAAAA,CAAC,CAACC,MAAF,CACEF,QAAQ,CAACD,GAAD,CAAR,CAAc,EAAd,CADF,EAEE,EAFF,EAGE,kEAHF;AAMAE,EAAAA,CAAC,CAACC,MAAF,CACEF,QAAQ,CACN,YAAM;AACJ,UAAM,IAAIG,KAAJ,CAAU,aAAV,CAAN;AACD,GAHK,EAIN,UAACC,KAAD,EAAQC,KAAR;AAAA,WAAkBN,GAAG,CAACM,KAAD,CAArB;AAAA,GAJM,CAAR,CAKE,EALF,CADF,EAOE,EAPF,EAQE,gEARF;AAWAJ,EAAAA,CAAC,CAACK,GAAF;AACD,CAnBG,CAAJ","sourcesContent":["import test from \"tape\"\n\nimport { inc } from \"../inc/inc.js\"\nimport { tryCatch } from \"./try-catch.js\"\n\ntest(\"tryCatch\", t => {\n t.equals(\n tryCatch(inc)(10),\n 11,\n \"Given tryer function not throwing, apply tryer function on input\"\n )\n\n t.equals(\n tryCatch(\n () => {\n throw new Error(\"Tryer error\")\n },\n (error, input) => inc(input)\n )(10),\n 11,\n \"Given tryer function throwing, apply catcher function on input\"\n )\n\n t.end()\n})\n"],"file":"try-catch.test.js"}
1
+ {"version":3,"sources":["../../src/try-catch/try-catch.test.js"],"sourcesContent":["import test from \"tape\"\n\nimport { inc } from \"../inc/inc.js\"\nimport { tryCatch } from \"./try-catch.js\"\n\ntest(\"tryCatch\", t => {\n t.equals(\n tryCatch(inc)(10),\n 11,\n \"Given tryer function not throwing, apply tryer function on input\"\n )\n\n t.equals(\n tryCatch(\n () => {\n throw new Error(\"Tryer error\")\n },\n (error, input) => inc(input)\n )(10),\n 11,\n \"Given tryer function throwing, apply catcher function on input\"\n )\n\n t.end()\n})\n"],"names":["test","inc","tryCatch","t","equals","Error","input","error","end"],"mappings":"AAAA,MAAM,CAACA,IAAI,MAAM,CAAM;AAEvB,MAAM,GAAGC,GAAG,QAAQ,CAAe;AACnC,MAAM,GAAGC,QAAQ,QAAQ,CAAgB;AAEzCF,IAAI,CAAC,CAAU,WAAEG,QAChB,CADgBA,CAAC,EAAI,CAAC;IACrBA,CAAC,CAACC,MAAM,CACNF,QAAQ,CAACD,GAAG,EAAE,EAAE,GAChB,EAAE,EACF,CAAkE;IAGpEE,CAAC,CAACC,MAAM,CACNF,QAAQ,CACN,QACN,GADY,CAAC;QACL,KAAK,CAAC,GAAG,CAACG,KAAK,CAAC,CAAa;IAC/B,CAAC,EACD,QAAQC,CAAPC,KAAK,EAAED,KAAK;QAAKL,MAAM,CAANA,GAAG,CAACK,KAAK;OAC3B,EAAE,GACJ,EAAE,EACF,CAAgE;IAGlEH,CAAC,CAACK,GAAG;AACP,CAAC"}
package/dist/type/type.js CHANGED
@@ -21,10 +21,9 @@
21
21
  * type(new Date()) // "Date"
22
22
  * type(() => {}) // "Function"
23
23
  * type(Promise.resolve()) // "Promise"
24
- */
25
- var type = function type(input) {
26
- return input === null ? "Null" : input === undefined ? "Undefined" : Object.prototype.toString.call(input).slice(8, -1);
24
+ */ var type = function(input) {
25
+ return input === null ? "Null" : input === undefined ? "Undefined" : Object.prototype.toString.call(input).slice(8, -1);
27
26
  };
28
-
29
27
  export { type };
28
+
30
29
  //# sourceMappingURL=type.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/type/type.js"],"names":["type","input","undefined","Object","prototype","toString","call","slice"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,IAAI,GAAG,SAAPA,IAAO,CAAAC,KAAK;AAAA,SAChBA,KAAK,KAAK,IAAV,GACI,MADJ,GAEIA,KAAK,KAAKC,SAAV,GACA,WADA,GAEAC,MAAM,CAACC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BL,KAA/B,EAAsCM,KAAtC,CAA4C,CAA5C,EAA+C,CAAC,CAAhD,CALY;AAAA,CAAlB;;AAOA,SAASP,IAAT","sourcesContent":["/**\n * From ramda: Gives a single-word string description of the (native) type of\n * a value, returning such answers as \"Object\", \"Number\", \"Array\", or \"Null\".\n *\n * Does not attempt to distinguish user Object types any further, reporting\n * them all as \"Object\".\n *\n * @param {any} input Something to check type on\n *\n * @returns {string}\n *\n * @example\n * type({}) // \"Object\"\n * type(1) // \"Number\"\n * type(false) // \"Boolean\"\n * type(\"s\") // \"String\"\n * type(null) // \"Null\"\n * type(undefined) // \"Undefined\"\n * type([]) // \"Array\"\n * type(/[A-z]/) // \"RegExp\"\n * type(new Date()) // \"Date\"\n * type(() => {}) // \"Function\"\n * type(Promise.resolve()) // \"Promise\"\n */\nconst type = input =>\n input === null\n ? \"Null\"\n : input === undefined\n ? \"Undefined\"\n : Object.prototype.toString.call(input).slice(8, -1)\n\nexport { type }\n"],"file":"type.js"}
1
+ {"version":3,"sources":["../../src/type/type.js"],"sourcesContent":["/**\n * From ramda: Gives a single-word string description of the (native) type of\n * a value, returning such answers as \"Object\", \"Number\", \"Array\", or \"Null\".\n *\n * Does not attempt to distinguish user Object types any further, reporting\n * them all as \"Object\".\n *\n * @param {any} input Something to check type on\n *\n * @returns {string}\n *\n * @example\n * type({}) // \"Object\"\n * type(1) // \"Number\"\n * type(false) // \"Boolean\"\n * type(\"s\") // \"String\"\n * type(null) // \"Null\"\n * type(undefined) // \"Undefined\"\n * type([]) // \"Array\"\n * type(/[A-z]/) // \"RegExp\"\n * type(new Date()) // \"Date\"\n * type(() => {}) // \"Function\"\n * type(Promise.resolve()) // \"Promise\"\n */\nconst type = input =>\n input === null\n ? \"Null\"\n : input === undefined\n ? \"Undefined\"\n : Object.prototype.toString.call(input).slice(8, -1)\n\nexport { type }\n"],"names":["type","input","undefined","Object","prototype","toString","call","slice"],"mappings":"AAAA,EAuBG,AAvBH;;;;;;;;;;;;;;;;;;;;;;;CAuBG,AAvBH,EAuBG,CACH,GAAK,CAACA,IAAI,GAAGC,QAAQ,CAARA,KAAK;IAChBA,MAAM,CAANA,KAAK,KAAK,IAAI,GACV,CAAM,QACNA,KAAK,KAAKC,SAAS,GACnB,CAAW,aACXC,MAAM,CAACC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACL,KAAK,EAAEM,KAAK,CAAC,CAAC,GAAG,CAAC;;AAEvD,MAAM,GAAGP,IAAI"}
@@ -1,19 +1,19 @@
1
- /* eslint-disable unicorn/no-null */
2
- import test from "tape";
1
+ /* eslint-disable unicorn/no-null */ import test from "tape";
3
2
  import { type } from "./type.js";
4
- test("type", function (t) {
5
- t.equal(type(null), "Null", "null should equal Null");
6
- t.equal(type(), "Undefined", "undefined should equal Undefined");
7
- t.equal(type(Number.NaN), "Number", "NaN should equal Number");
8
- t.equal(type(false), "Boolean", "false should equal Boolean");
9
- t.equal(type(2), "Number", "2 should equal Number");
10
- t.equal(type(""), "String", '"" should equal String');
11
- t.equal(type([]), "Array", "[] should equal Array");
12
- t.equal(type({}), "Object", "{} should equal Object");
13
- t.equal(type(new Date()), "Date", "new Date() should equal Date");
14
- t.equal(type(function () {}), "Function", "() => {} should equal Function");
15
- t.equal(type(/[A-z]/), "RegExp", "/[A-z]/ should equal RegExp");
16
- t.equal(type(Promise.resolve(2)), "Promise", "Promise.resolve(2) should equal Promise");
17
- t.end();
3
+ test("type", function(t) {
4
+ t.equal(type(null), "Null", "null should equal Null");
5
+ t.equal(type(), "Undefined", "undefined should equal Undefined");
6
+ t.equal(type(Number.NaN), "Number", "NaN should equal Number");
7
+ t.equal(type(false), "Boolean", "false should equal Boolean");
8
+ t.equal(type(2), "Number", "2 should equal Number");
9
+ t.equal(type(""), "String", '"" should equal String');
10
+ t.equal(type([]), "Array", "[] should equal Array");
11
+ t.equal(type({}), "Object", "{} should equal Object");
12
+ t.equal(type(new Date()), "Date", "new Date() should equal Date");
13
+ t.equal(type(function() {}), "Function", "() => {} should equal Function");
14
+ t.equal(type(/[A-z]/), "RegExp", "/[A-z]/ should equal RegExp");
15
+ t.equal(type(Promise.resolve(2)), "Promise", "Promise.resolve(2) should equal Promise");
16
+ t.end();
18
17
  });
18
+
19
19
  //# sourceMappingURL=type.test.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/type/type.test.js"],"names":["test","type","t","equal","Number","NaN","Date","Promise","resolve","end"],"mappings":"AAAA;AAEA,OAAOA,IAAP,MAAiB,MAAjB;AAEA,SAASC,IAAT,QAAqB,WAArB;AAEAD,IAAI,CAAC,MAAD,EAAS,UAAAE,CAAC,EAAI;AAChBA,EAAAA,CAAC,CAACC,KAAF,CAAQF,IAAI,CAAC,IAAD,CAAZ,EAAoB,MAApB,EAA4B,wBAA5B;AACAC,EAAAA,CAAC,CAACC,KAAF,CAAQF,IAAI,EAAZ,EAAgB,WAAhB,EAA6B,kCAA7B;AACAC,EAAAA,CAAC,CAACC,KAAF,CAAQF,IAAI,CAACG,MAAM,CAACC,GAAR,CAAZ,EAA0B,QAA1B,EAAoC,yBAApC;AACAH,EAAAA,CAAC,CAACC,KAAF,CAAQF,IAAI,CAAC,KAAD,CAAZ,EAAqB,SAArB,EAAgC,4BAAhC;AACAC,EAAAA,CAAC,CAACC,KAAF,CAAQF,IAAI,CAAC,CAAD,CAAZ,EAAiB,QAAjB,EAA2B,uBAA3B;AACAC,EAAAA,CAAC,CAACC,KAAF,CAAQF,IAAI,CAAC,EAAD,CAAZ,EAAkB,QAAlB,EAA4B,wBAA5B;AACAC,EAAAA,CAAC,CAACC,KAAF,CAAQF,IAAI,CAAC,EAAD,CAAZ,EAAkB,OAAlB,EAA2B,uBAA3B;AACAC,EAAAA,CAAC,CAACC,KAAF,CAAQF,IAAI,CAAC,EAAD,CAAZ,EAAkB,QAAlB,EAA4B,wBAA5B;AACAC,EAAAA,CAAC,CAACC,KAAF,CAAQF,IAAI,CAAC,IAAIK,IAAJ,EAAD,CAAZ,EAA0B,MAA1B,EAAkC,8BAAlC;AACAJ,EAAAA,CAAC,CAACC,KAAF,CACEF,IAAI,CAAC,YAAM,CAAE,CAAT,CADN,EAEE,UAFF,EAGE,gCAHF;AAKAC,EAAAA,CAAC,CAACC,KAAF,CAAQF,IAAI,CAAC,OAAD,CAAZ,EAAuB,QAAvB,EAAiC,6BAAjC;AACAC,EAAAA,CAAC,CAACC,KAAF,CACEF,IAAI,CAACM,OAAO,CAACC,OAAR,CAAgB,CAAhB,CAAD,CADN,EAEE,SAFF,EAGE,yCAHF;AAKAN,EAAAA,CAAC,CAACO,GAAF;AACD,CAtBG,CAAJ","sourcesContent":["/* eslint-disable unicorn/no-null */\n\nimport test from \"tape\"\n\nimport { type } from \"./type.js\"\n\ntest(\"type\", t => {\n t.equal(type(null), \"Null\", \"null should equal Null\")\n t.equal(type(), \"Undefined\", \"undefined should equal Undefined\")\n t.equal(type(Number.NaN), \"Number\", \"NaN should equal Number\")\n t.equal(type(false), \"Boolean\", \"false should equal Boolean\")\n t.equal(type(2), \"Number\", \"2 should equal Number\")\n t.equal(type(\"\"), \"String\", '\"\" should equal String')\n t.equal(type([]), \"Array\", \"[] should equal Array\")\n t.equal(type({}), \"Object\", \"{} should equal Object\")\n t.equal(type(new Date()), \"Date\", \"new Date() should equal Date\")\n t.equal(\n type(() => {}),\n \"Function\",\n \"() => {} should equal Function\"\n )\n t.equal(type(/[A-z]/), \"RegExp\", \"/[A-z]/ should equal RegExp\")\n t.equal(\n type(Promise.resolve(2)),\n \"Promise\",\n \"Promise.resolve(2) should equal Promise\"\n )\n t.end()\n})\n"],"file":"type.test.js"}
1
+ {"version":3,"sources":["../../src/type/type.test.js"],"sourcesContent":["/* eslint-disable unicorn/no-null */\n\nimport test from \"tape\"\n\nimport { type } from \"./type.js\"\n\ntest(\"type\", t => {\n t.equal(type(null), \"Null\", \"null should equal Null\")\n t.equal(type(), \"Undefined\", \"undefined should equal Undefined\")\n t.equal(type(Number.NaN), \"Number\", \"NaN should equal Number\")\n t.equal(type(false), \"Boolean\", \"false should equal Boolean\")\n t.equal(type(2), \"Number\", \"2 should equal Number\")\n t.equal(type(\"\"), \"String\", '\"\" should equal String')\n t.equal(type([]), \"Array\", \"[] should equal Array\")\n t.equal(type({}), \"Object\", \"{} should equal Object\")\n t.equal(type(new Date()), \"Date\", \"new Date() should equal Date\")\n t.equal(\n type(() => {}),\n \"Function\",\n \"() => {} should equal Function\"\n )\n t.equal(type(/[A-z]/), \"RegExp\", \"/[A-z]/ should equal RegExp\")\n t.equal(\n type(Promise.resolve(2)),\n \"Promise\",\n \"Promise.resolve(2) should equal Promise\"\n )\n t.end()\n})\n"],"names":["test","type","t","equal","Number","NaN","Date","Promise","resolve","end"],"mappings":"AAAA,EAAoC,AAApC,gCAAoC,AAApC,EAAoC,CAEpC,MAAM,CAACA,IAAI,MAAM,CAAM;AAEvB,MAAM,GAAGC,IAAI,QAAQ,CAAW;AAEhCD,IAAI,CAAC,CAAM,OAAEE,QACZ,CADYA,CAAC,EAAI,CAAC;IACjBA,CAAC,CAACC,KAAK,CAACF,IAAI,CAAC,IAAI,GAAG,CAAM,OAAE,CAAwB;IACpDC,CAAC,CAACC,KAAK,CAACF,IAAI,IAAI,CAAW,YAAE,CAAkC;IAC/DC,CAAC,CAACC,KAAK,CAACF,IAAI,CAACG,MAAM,CAACC,GAAG,GAAG,CAAQ,SAAE,CAAyB;IAC7DH,CAAC,CAACC,KAAK,CAACF,IAAI,CAAC,KAAK,GAAG,CAAS,UAAE,CAA4B;IAC5DC,CAAC,CAACC,KAAK,CAACF,IAAI,CAAC,CAAC,GAAG,CAAQ,SAAE,CAAuB;IAClDC,CAAC,CAACC,KAAK,CAACF,IAAI,CAAC,CAAE,IAAG,CAAQ,SAAE,CAAwB;IACpDC,CAAC,CAACC,KAAK,CAACF,IAAI,CAAC,CAAC,CAAC,GAAG,CAAO,QAAE,CAAuB;IAClDC,CAAC,CAACC,KAAK,CAACF,IAAI,CAAC,CAAC,CAAC,GAAG,CAAQ,SAAE,CAAwB;IACpDC,CAAC,CAACC,KAAK,CAACF,IAAI,CAAC,GAAG,CAACK,IAAI,KAAK,CAAM,OAAE,CAA8B;IAChEJ,CAAC,CAACC,KAAK,CACLF,IAAI,CAAC,QAAQ,GAAF,CAAC,CAAC,GACb,CAAU,WACV,CAAgC;IAElCC,CAAC,CAACC,KAAK,CAACF,IAAI,WAAW,CAAQ,SAAE,CAA6B;IAC9DC,CAAC,CAACC,KAAK,CACLF,IAAI,CAACM,OAAO,CAACC,OAAO,CAAC,CAAC,IACtB,CAAS,UACT,CAAyC;IAE3CN,CAAC,CAACO,GAAG;AACP,CAAC"}
@@ -1,7 +1,6 @@
1
1
  import { curry } from "../curry/curry.js";
2
-
3
- var _unite = function _unite(separator, input) {
4
- return Array.prototype.join.call(input, separator);
2
+ var _unite = function(separator, input) {
3
+ return Array.prototype.join.call(input, separator);
5
4
  };
6
5
  /**
7
6
  * Unite all elements of an array into a string
@@ -18,8 +17,6 @@ var _unite = function _unite(separator, input) {
18
17
  * @example
19
18
  * unite(",", ["lorem", "ipsum"])
20
19
  * // => "lorem,ipsum"
21
- */
22
-
20
+ */ export var unite = curry(_unite);
23
21
 
24
- export var unite = curry(_unite);
25
22
  //# sourceMappingURL=unite.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/unite/unite.js"],"names":["curry","_unite","separator","input","Array","prototype","join","call","unite"],"mappings":"AAAA,SAASA,KAAT,QAAsB,mBAAtB;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAACC,SAAD,EAAYC,KAAZ;AAAA,SAAsBC,KAAK,CAACC,SAAN,CAAgBC,IAAhB,CAAqBC,IAArB,CAA0BJ,KAA1B,EAAiCD,SAAjC,CAAtB;AAAA,CAAf;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,IAAMM,KAAK,GAAGR,KAAK,CAACC,MAAD,CAAnB","sourcesContent":["import { curry } from \"../curry/curry.js\"\n\nconst _unite = (separator, input) => Array.prototype.join.call(input, separator)\n\n/**\n * Unite all elements of an array into a string\n *\n * @param {string} separator Separator between each adjacent elements\n * @param {Array} source Source array\n *\n * @returns {string}\n *\n * @name unite\n * @tag Array\n * @signature (separator: String, source: Array) => String\n *\n * @example\n * unite(\",\", [\"lorem\", \"ipsum\"])\n * // => \"lorem,ipsum\"\n */\nexport const unite = curry(_unite)\n"],"file":"unite.js"}
1
+ {"version":3,"sources":["../../src/unite/unite.js"],"sourcesContent":["import { curry } from \"../curry/curry.js\"\n\nconst _unite = (separator, input) => Array.prototype.join.call(input, separator)\n\n/**\n * Unite all elements of an array into a string\n *\n * @param {string} separator Separator between each adjacent elements\n * @param {Array} source Source array\n *\n * @returns {string}\n *\n * @name unite\n * @tag Array\n * @signature (separator: String, source: Array) => String\n *\n * @example\n * unite(\",\", [\"lorem\", \"ipsum\"])\n * // => \"lorem,ipsum\"\n */\nexport const unite = curry(_unite)\n"],"names":["curry","_unite","separator","input","Array","prototype","join","call","unite"],"mappings":"AAAA,MAAM,GAAGA,KAAK,QAAQ,CAAmB;AAEzC,GAAK,CAACC,MAAM,GAAG,QAAQ,CAAPC,SAAS,EAAEC,KAAK;IAAKC,MAAMC,CAAND,KAAK,CAACC,SAAS,CAACC,IAAI,CAACC,IAAI,CAACJ,KAAK,EAAED,SAAS;;AAE/E,EAeG,AAfH;;;;;;;;;;;;;;;CAeG,AAfH,EAeG,CACH,MAAM,CAAC,GAAK,CAACM,KAAK,GAAGR,KAAK,CAACC,MAAM"}
@@ -1,7 +1,12 @@
1
1
  import test from "tape";
2
2
  import { unite } from "./unite.js";
3
- test("unite", function (t) {
4
- t.deepEqual(unite(",", [1, 2, 3]), "1,2,3", "given [a comma and and array] should [return a string with items separated by comma]");
5
- t.end();
3
+ test("unite", function(t) {
4
+ t.deepEqual(unite(",", [
5
+ 1,
6
+ 2,
7
+ 3
8
+ ]), "1,2,3", "given [a comma and and array] should [return a string with items separated by comma]");
9
+ t.end();
6
10
  });
11
+
7
12
  //# sourceMappingURL=unite.test.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/unite/unite.test.js"],"names":["test","unite","t","deepEqual","end"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,MAAjB;AAEA,SAASC,KAAT,QAAsB,YAAtB;AAEAD,IAAI,CAAC,OAAD,EAAU,UAAAE,CAAC,EAAI;AACjBA,EAAAA,CAAC,CAACC,SAAF,CACEF,KAAK,CAAC,GAAD,EAAM,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAAN,CADP,EAEE,OAFF,EAGE,sFAHF;AAMAC,EAAAA,CAAC,CAACE,GAAF;AACD,CARG,CAAJ","sourcesContent":["import test from \"tape\"\n\nimport { unite } from \"./unite.js\"\n\ntest(\"unite\", t => {\n t.deepEqual(\n unite(\",\", [1, 2, 3]),\n \"1,2,3\",\n \"given [a comma and and array] should [return a string with items separated by comma]\"\n )\n\n t.end()\n})\n"],"file":"unite.test.js"}
1
+ {"version":3,"sources":["../../src/unite/unite.test.js"],"sourcesContent":["import test from \"tape\"\n\nimport { unite } from \"./unite.js\"\n\ntest(\"unite\", t => {\n t.deepEqual(\n unite(\",\", [1, 2, 3]),\n \"1,2,3\",\n \"given [a comma and and array] should [return a string with items separated by comma]\"\n )\n\n t.end()\n})\n"],"names":["test","unite","t","deepEqual","end"],"mappings":"AAAA,MAAM,CAACA,IAAI,MAAM,CAAM;AAEvB,MAAM,GAAGC,KAAK,QAAQ,CAAY;AAElCD,IAAI,CAAC,CAAO,QAAEE,QACb,CADaA,CAAC,EAAI,CAAC;IAClBA,CAAC,CAACC,SAAS,CACTF,KAAK,CAAC,CAAG,IAAE,CAAC;AAAA,SAAC;AAAE,SAAC;AAAE,SAAC;IAAA,CAAC,GACpB,CAAO,QACP,CAAsF;IAGxFC,CAAC,CAACE,GAAG;AACP,CAAC"}
@@ -1,90 +1,83 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
-
4
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
5
-
6
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
7
-
1
+ import * as swcHelpers from "@swc/helpers";
8
2
  import { map } from "../map/map.js";
9
3
  import { isMatch } from "../is-match/is-match.js";
10
-
11
- var _update = function _update(transformations, input) {
12
- var entries = Object.entries(transformations);
13
-
14
- var result = _objectSpread({}, input);
15
-
16
- for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
17
- var _entries$_i = _slicedToArray(_entries[_i], 2),
18
- key = _entries$_i[0],
19
- value = _entries$_i[1];
20
-
21
- result[key] = typeof value === "function" ? value(input[key], input) : value;
22
- }
23
-
24
- return result;
4
+ var _update = function(transformations, input) {
5
+ var entries = Object.entries(transformations);
6
+ var result = swcHelpers.objectSpread({}, input);
7
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
8
+ try {
9
+ for(var _iterator = entries[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
10
+ var _value = swcHelpers.slicedToArray(_step.value, 2), key = _value[0], value = _value[1];
11
+ result[key] = typeof value === "function" ? value(input[key], input) : value;
12
+ }
13
+ } catch (err) {
14
+ _didIteratorError = true;
15
+ _iteratorError = err;
16
+ } finally{
17
+ try {
18
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
19
+ _iterator.return();
20
+ }
21
+ } finally{
22
+ if (_didIteratorError) {
23
+ throw _iteratorError;
24
+ }
25
+ }
26
+ }
27
+ return result;
25
28
  };
26
-
27
- var _updateWith = function _updateWith(filter, transformations, input) {
28
- var result = [];
29
-
30
- for (var i = 0, length = input.length; i < length; ++i) {
31
- var item = input[i];
32
- var shouldMutate = isMatch(filter, item);
33
- result.push(shouldMutate ? _update(transformations, item) : item);
34
- }
35
-
36
- return result;
29
+ var _updateWith = function(filter, transformations, input) {
30
+ var result = [];
31
+ for(var i = 0, length = input.length; i < length; ++i){
32
+ var item = input[i];
33
+ var shouldMutate = isMatch(filter, item);
34
+ result.push(shouldMutate ? _update(transformations, item) : item);
35
+ }
36
+ return result;
37
37
  };
38
-
39
- var _updateMany = function _updateMany(transformations, input) {
40
- return map(function (item) {
41
- return _update(transformations, item);
42
- }, input);
38
+ var _updateMany = function(transformations, input) {
39
+ return map(function(item) {
40
+ return _update(transformations, item);
41
+ }, input);
43
42
  };
44
-
45
- export var update = function update() {
46
- for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
47
- params[_key] = arguments[_key];
48
- }
49
-
50
- // @signature (transformations) => (source)
51
- if (params.length <= 1) {
52
- return function (input) {
53
- return _update(params[0], input);
54
- };
55
- } // @signature (transformations, source)
56
-
57
-
58
- return _update.apply(void 0, params);
43
+ export var update = function() {
44
+ for(var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++){
45
+ params[_key] = arguments[_key];
46
+ }
47
+ // @signature (transformations) => (source)
48
+ if (params.length <= 1) {
49
+ return function(input) {
50
+ return _update(params[0], input);
51
+ };
52
+ }
53
+ // @signature (transformations, source)
54
+ return _update.apply(void 0, swcHelpers.toConsumableArray(params));
59
55
  };
60
- export var updateMany = function updateMany() {
61
- for (var _len2 = arguments.length, params = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
62
- params[_key2] = arguments[_key2];
63
- }
64
-
65
- // @signature (transformations) => (source)
66
- if (params.length <= 1) {
67
- return function (input) {
68
- return _updateMany(params[0], input);
69
- };
70
- } // @signature (transformations, source)
71
-
72
-
73
- return _updateMany.apply(void 0, params);
56
+ export var updateMany = function() {
57
+ for(var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++){
58
+ params[_key] = arguments[_key];
59
+ }
60
+ // @signature (transformations) => (source)
61
+ if (params.length <= 1) {
62
+ return function(input) {
63
+ return _updateMany(params[0], input);
64
+ };
65
+ }
66
+ // @signature (transformations, source)
67
+ return _updateMany.apply(void 0, swcHelpers.toConsumableArray(params));
74
68
  };
75
- export var updateWith = function updateWith() {
76
- for (var _len3 = arguments.length, params = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
77
- params[_key3] = arguments[_key3];
78
- }
79
-
80
- // @signature (filter, transformations) => (source)
81
- if (params.length <= 2) {
82
- return function (input) {
83
- return _updateWith(params[0], params[1], input);
84
- };
85
- } // @signature (filter, transformations, source)
86
-
87
-
88
- return _updateWith.apply(void 0, params);
69
+ export var updateWith = function() {
70
+ for(var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++){
71
+ params[_key] = arguments[_key];
72
+ }
73
+ // @signature (filter, transformations) => (source)
74
+ if (params.length <= 2) {
75
+ return function(input) {
76
+ return _updateWith(params[0], params[1], input);
77
+ };
78
+ }
79
+ // @signature (filter, transformations, source)
80
+ return _updateWith.apply(void 0, swcHelpers.toConsumableArray(params));
89
81
  };
82
+
90
83
  //# sourceMappingURL=update.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/update/update.js"],"names":["map","isMatch","_update","transformations","input","entries","Object","result","key","value","_updateWith","filter","i","length","item","shouldMutate","push","_updateMany","update","params","updateMany","updateWith"],"mappings":";;;;;;;AAAA,SAASA,GAAT,QAAoB,eAApB;AACA,SAASC,OAAT,QAAwB,yBAAxB;;AAEA,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAACC,eAAD,EAAkBC,KAAlB,EAA4B;AAC1C,MAAMC,OAAO,GAAGC,MAAM,CAACD,OAAP,CAAeF,eAAf,CAAhB;;AACA,MAAMI,MAAM,qBAAQH,KAAR,CAAZ;;AAEA,8BAA2BC,OAA3B,8BAAoC;AAA/B;AAAA,QAAOG,GAAP;AAAA,QAAYC,KAAZ;;AACHF,IAAAA,MAAM,CAACC,GAAD,CAAN,GAAc,OAAOC,KAAP,KAAiB,UAAjB,GAA8BA,KAAK,CAACL,KAAK,CAACI,GAAD,CAAN,EAAaJ,KAAb,CAAnC,GAAyDK,KAAvE;AACD;;AAED,SAAOF,MAAP;AACD,CATD;;AAWA,IAAMG,WAAW,GAAG,SAAdA,WAAc,CAACC,MAAD,EAASR,eAAT,EAA0BC,KAA1B,EAAoC;AACtD,MAAMG,MAAM,GAAG,EAAf;;AAEA,OAAK,IAAIK,CAAC,GAAG,CAAR,EAAWC,MAAM,GAAGT,KAAK,CAACS,MAA/B,EAAuCD,CAAC,GAAGC,MAA3C,EAAmD,EAAED,CAArD,EAAwD;AACtD,QAAME,IAAI,GAAGV,KAAK,CAACQ,CAAD,CAAlB;AACA,QAAMG,YAAY,GAAGd,OAAO,CAACU,MAAD,EAASG,IAAT,CAA5B;AAEAP,IAAAA,MAAM,CAACS,IAAP,CAAYD,YAAY,GAAGb,OAAO,CAACC,eAAD,EAAkBW,IAAlB,CAAV,GAAoCA,IAA5D;AACD;;AAED,SAAOP,MAAP;AACD,CAXD;;AAaA,IAAMU,WAAW,GAAG,SAAdA,WAAc,CAACd,eAAD,EAAkBC,KAAlB;AAAA,SAClBJ,GAAG,CAAC,UAAAc,IAAI;AAAA,WAAIZ,OAAO,CAACC,eAAD,EAAkBW,IAAlB,CAAX;AAAA,GAAL,EAAyCV,KAAzC,CADe;AAAA,CAApB;;AAGA,OAAO,IAAMc,MAAM,GAAG,SAATA,MAAS,GAAe;AAAA,oCAAXC,MAAW;AAAXA,IAAAA,MAAW;AAAA;;AACnC;AACA,MAAIA,MAAM,CAACN,MAAP,IAAiB,CAArB,EAAwB;AACtB,WAAO,UAAAT,KAAK;AAAA,aAAIF,OAAO,CAACiB,MAAM,CAAC,CAAD,CAAP,EAAYf,KAAZ,CAAX;AAAA,KAAZ;AACD,GAJkC,CAMnC;;;AACA,SAAOF,OAAO,MAAP,SAAWiB,MAAX,CAAP;AACD,CARM;AAUP,OAAO,IAAMC,UAAU,GAAG,SAAbA,UAAa,GAAe;AAAA,qCAAXD,MAAW;AAAXA,IAAAA,MAAW;AAAA;;AACvC;AACA,MAAIA,MAAM,CAACN,MAAP,IAAiB,CAArB,EAAwB;AACtB,WAAO,UAAAT,KAAK;AAAA,aAAIa,WAAW,CAACE,MAAM,CAAC,CAAD,CAAP,EAAYf,KAAZ,CAAf;AAAA,KAAZ;AACD,GAJsC,CAMvC;;;AACA,SAAOa,WAAW,MAAX,SAAeE,MAAf,CAAP;AACD,CARM;AAUP,OAAO,IAAME,UAAU,GAAG,SAAbA,UAAa,GAAe;AAAA,qCAAXF,MAAW;AAAXA,IAAAA,MAAW;AAAA;;AACvC;AACA,MAAIA,MAAM,CAACN,MAAP,IAAiB,CAArB,EAAwB;AACtB,WAAO,UAAAT,KAAK;AAAA,aAAIM,WAAW,CAACS,MAAM,CAAC,CAAD,CAAP,EAAYA,MAAM,CAAC,CAAD,CAAlB,EAAuBf,KAAvB,CAAf;AAAA,KAAZ;AACD,GAJsC,CAMvC;;;AACA,SAAOM,WAAW,MAAX,SAAeS,MAAf,CAAP;AACD,CARM","sourcesContent":["import { map } from \"../map/map.js\"\nimport { isMatch } from \"../is-match/is-match.js\"\n\nconst _update = (transformations, input) => {\n const entries = Object.entries(transformations)\n const result = { ...input }\n\n for (const [key, value] of entries) {\n result[key] = typeof value === \"function\" ? value(input[key], input) : value\n }\n\n return result\n}\n\nconst _updateWith = (filter, transformations, input) => {\n const result = []\n\n for (let i = 0, length = input.length; i < length; ++i) {\n const item = input[i]\n const shouldMutate = isMatch(filter, item)\n\n result.push(shouldMutate ? _update(transformations, item) : item)\n }\n\n return result\n}\n\nconst _updateMany = (transformations, input) =>\n map(item => _update(transformations, item), input)\n\nexport const update = (...params) => {\n // @signature (transformations) => (source)\n if (params.length <= 1) {\n return input => _update(params[0], input)\n }\n\n // @signature (transformations, source)\n return _update(...params)\n}\n\nexport const updateMany = (...params) => {\n // @signature (transformations) => (source)\n if (params.length <= 1) {\n return input => _updateMany(params[0], input)\n }\n\n // @signature (transformations, source)\n return _updateMany(...params)\n}\n\nexport const updateWith = (...params) => {\n // @signature (filter, transformations) => (source)\n if (params.length <= 2) {\n return input => _updateWith(params[0], params[1], input)\n }\n\n // @signature (filter, transformations, source)\n return _updateWith(...params)\n}\n"],"file":"update.js"}
1
+ {"version":3,"sources":["../../src/update/update.js"],"sourcesContent":["import { map } from \"../map/map.js\"\nimport { isMatch } from \"../is-match/is-match.js\"\n\nconst _update = (transformations, input) => {\n const entries = Object.entries(transformations)\n const result = { ...input }\n\n for (const [key, value] of entries) {\n result[key] = typeof value === \"function\" ? value(input[key], input) : value\n }\n\n return result\n}\n\nconst _updateWith = (filter, transformations, input) => {\n const result = []\n\n for (let i = 0, length = input.length; i < length; ++i) {\n const item = input[i]\n const shouldMutate = isMatch(filter, item)\n\n result.push(shouldMutate ? _update(transformations, item) : item)\n }\n\n return result\n}\n\nconst _updateMany = (transformations, input) =>\n map(item => _update(transformations, item), input)\n\nexport const update = (...params) => {\n // @signature (transformations) => (source)\n if (params.length <= 1) {\n return input => _update(params[0], input)\n }\n\n // @signature (transformations, source)\n return _update(...params)\n}\n\nexport const updateMany = (...params) => {\n // @signature (transformations) => (source)\n if (params.length <= 1) {\n return input => _updateMany(params[0], input)\n }\n\n // @signature (transformations, source)\n return _updateMany(...params)\n}\n\nexport const updateWith = (...params) => {\n // @signature (filter, transformations) => (source)\n if (params.length <= 2) {\n return input => _updateWith(params[0], params[1], input)\n }\n\n // @signature (filter, transformations, source)\n return _updateWith(...params)\n}\n"],"names":["map","isMatch","_update","transformations","input","entries","Object","result","key","value","_updateWith","filter","i","length","item","shouldMutate","push","_updateMany","update","params","updateMany","updateWith"],"mappings":";AAAA,MAAM,GAAGA,GAAG,QAAQ,CAAe;AACnC,MAAM,GAAGC,OAAO,QAAQ,CAAyB;AAEjD,GAAK,CAACC,OAAO,GAAG,QAAQ,CAAPC,eAAe,EAAEC,KAAK,EAAK,CAAC;IAC3C,GAAK,CAACC,OAAO,GAAGC,MAAM,CAACD,OAAO,CAACF,eAAe;IAC9C,GAAK,CAACI,MAAM,+BAAQH,KAAK;QAEpB,yBAAkB,SAAlB,iBAAkB,UAAlB,cAAkB;;QAAvB,GAAG,KAAE,SAAkB,GAAIC,OAAO,qBAA7B,KAAkB,IAAlB,yBAAkB,IAAlB,KAAkB,GAAlB,SAAkB,gBAAlB,yBAAkB,QAAa,CAAC;YAAhC,GAAK,mCAAL,KAAkB,YAAXG,GAAG,cAAEC,KAAK;YACpBF,MAAM,CAACC,GAAG,IAAI,MAAM,CAACC,KAAK,KAAK,CAAU,YAAGA,KAAK,CAACL,KAAK,CAACI,GAAG,GAAGJ,KAAK,IAAIK,KAAK;QAC9E,CAAC;;QAFI,iBAAkB;QAAlB,cAAkB;;;iBAAlB,yBAAkB,IAAlB,SAAkB;gBAAlB,SAAkB;;;gBAAlB,iBAAkB;sBAAlB,cAAkB;;;;IAIvB,MAAM,CAACF,MAAM;AACf,CAAC;AAED,GAAK,CAACG,WAAW,GAAG,QAAQ,CAAPC,MAAM,EAAER,eAAe,EAAEC,KAAK,EAAK,CAAC;IACvD,GAAK,CAACG,MAAM,GAAG,CAAC,CAAC;IAEjB,GAAG,CAAE,GAAG,CAACK,CAAC,GAAG,CAAC,EAAEC,MAAM,GAAGT,KAAK,CAACS,MAAM,EAAED,CAAC,GAAGC,MAAM,IAAID,CAAC,CAAE,CAAC;QACvD,GAAK,CAACE,IAAI,GAAGV,KAAK,CAACQ,CAAC;QACpB,GAAK,CAACG,YAAY,GAAGd,OAAO,CAACU,MAAM,EAAEG,IAAI;QAEzCP,MAAM,CAACS,IAAI,CAACD,YAAY,GAAGb,OAAO,CAACC,eAAe,EAAEW,IAAI,IAAIA,IAAI;IAClE,CAAC;IAED,MAAM,CAACP,MAAM;AACf,CAAC;AAED,GAAK,CAACU,WAAW,GAAG,QAAQ,CAAPd,eAAe,EAAEC,KAAK;IACzCJ,MAAM,CAANA,GAAG,CAACc,QAAQZ,CAARY,IAAI;QAAIZ,MAAM,CAANA,OAAO,CAACC,eAAe,EAAEW,IAAI;OAAGV,KAAK;;AAEnD,MAAM,CAAC,GAAK,CAACc,MAAM,GAAG,QAAQ,GAAO,CAAC;qCAAZC,MAAM;QAANA,MAAM;;IAC9B,EAA2C,AAA3C,yCAA2C;IAC3C,EAAE,EAAEA,MAAM,CAACN,MAAM,IAAI,CAAC,EAAE,CAAC;QACvB,MAAM,CAACT,QAAQ,CAARA,KAAK;YAAIF,MAAM,CAANA,OAAO,CAACiB,MAAM,CAAC,CAAC,GAAGf,KAAK;;IAC1C,CAAC;IAED,EAAuC,AAAvC,qCAAuC;IACvC,MAAM,CAACF,OAAO,CAAPA,KAAkB,CAAlBA,IAAI,CAAJA,CAAO,+BAAIiB,MAAM;AAC1B,CAAC;AAED,MAAM,CAAC,GAAK,CAACC,UAAU,GAAG,QAAQ,GAAO,CAAC;qCAAZD,MAAM;QAANA,MAAM;;IAClC,EAA2C,AAA3C,yCAA2C;IAC3C,EAAE,EAAEA,MAAM,CAACN,MAAM,IAAI,CAAC,EAAE,CAAC;QACvB,MAAM,CAACT,QAAQ,CAARA,KAAK;YAAIa,MAAM,CAANA,WAAW,CAACE,MAAM,CAAC,CAAC,GAAGf,KAAK;;IAC9C,CAAC;IAED,EAAuC,AAAvC,qCAAuC;IACvC,MAAM,CAACa,WAAW,CAAXA,KAAsB,CAAtBA,IAAI,CAAJA,CAAW,+BAAIE,MAAM;AAC9B,CAAC;AAED,MAAM,CAAC,GAAK,CAACE,UAAU,GAAG,QAAQ,GAAO,CAAC;qCAAZF,MAAM;QAANA,MAAM;;IAClC,EAAmD,AAAnD,iDAAmD;IACnD,EAAE,EAAEA,MAAM,CAACN,MAAM,IAAI,CAAC,EAAE,CAAC;QACvB,MAAM,CAACT,QAAQ,CAARA,KAAK;YAAIM,MAAM,CAANA,WAAW,CAACS,MAAM,CAAC,CAAC,GAAGA,MAAM,CAAC,CAAC,GAAGf,KAAK;;IACzD,CAAC;IAED,EAA+C,AAA/C,6CAA+C;IAC/C,MAAM,CAACM,WAAW,CAAXA,KAAsB,CAAtBA,IAAI,CAAJA,CAAW,+BAAIS,MAAM;AAC9B,CAAC"}
@@ -1,86 +1,99 @@
1
1
  import test from "tape";
2
2
  import { update, updateMany, updateWith } from "./update.js";
3
-
4
- var inc = function inc(x) {
5
- return x + 1;
3
+ var inc = function(x) {
4
+ return x + 1;
6
5
  };
7
-
8
- test("update", function (t) {
9
- t.deepEqual(update({
10
- test: "changed"
11
- }, {
12
- test: "Lorem Ipsum"
13
- }), {
14
- test: "changed"
15
- }, "Updating existing property should return changed object");
16
- t.deepEqual(update({
17
- test: inc
18
- })({
19
- test: 2
20
- }), {
21
- test: 3
22
- }, "Updating existing property with function should return changed object");
23
- t.deepEqual(update({
24
- notExist: 2
25
- }, {
26
- test: "Lorem Ipsum"
27
- }), {
28
- test: "Lorem Ipsum",
29
- notExist: 2
30
- }, "Updating non-existing property should return changed object");
31
- t.deepEqual(update({
32
- test: function test(input, item) {
33
- return "".concat(input, " ").concat(item.foo);
34
- }
35
- }, {
36
- foo: "bar",
37
- test: "Lorem Ipsum"
38
- }), {
39
- foo: "bar",
40
- test: "Lorem Ipsum bar"
41
- }, "Updating existing property based on other field should return changed object");
42
- t.end();
6
+ test("update", function(t) {
7
+ t.deepEqual(update({
8
+ test: "changed"
9
+ }, {
10
+ test: "Lorem Ipsum"
11
+ }), {
12
+ test: "changed"
13
+ }, "Updating existing property should return changed object");
14
+ t.deepEqual(update({
15
+ test: inc
16
+ })({
17
+ test: 2
18
+ }), {
19
+ test: 3
20
+ }, "Updating existing property with function should return changed object");
21
+ t.deepEqual(update({
22
+ notExist: 2
23
+ }, {
24
+ test: "Lorem Ipsum"
25
+ }), {
26
+ test: "Lorem Ipsum",
27
+ notExist: 2
28
+ }, "Updating non-existing property should return changed object");
29
+ t.deepEqual(update({
30
+ test: function(input, item) {
31
+ return "".concat(input, " ").concat(item.foo);
32
+ }
33
+ }, {
34
+ foo: "bar",
35
+ test: "Lorem Ipsum"
36
+ }), {
37
+ foo: "bar",
38
+ test: "Lorem Ipsum bar"
39
+ }, "Updating existing property based on other field should return changed object");
40
+ t.end();
43
41
  });
44
- test("updateMany", function (t) {
45
- t.deepEqual(updateMany({
46
- id: function id() {
47
- var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
48
- return input + 1;
49
- }
50
- }, [{
51
- id: 1
52
- }, {
53
- id: 2
54
- }, {
55
- test: "dolor"
56
- }]), [{
57
- id: 2
58
- }, {
59
- id: 3
60
- }, {
61
- id: 1,
62
- test: "dolor"
63
- }], "Updating existing and unexisting properties should return changed object");
64
- t.end();
42
+ test("updateMany", function(t) {
43
+ t.deepEqual(updateMany({
44
+ id: function() {
45
+ var input = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
46
+ return input + 1;
47
+ }
48
+ }, [
49
+ {
50
+ id: 1
51
+ },
52
+ {
53
+ id: 2
54
+ },
55
+ {
56
+ test: "dolor"
57
+ }
58
+ ]), [
59
+ {
60
+ id: 2
61
+ },
62
+ {
63
+ id: 3
64
+ },
65
+ {
66
+ id: 1,
67
+ test: "dolor"
68
+ }
69
+ ], "Updating existing and unexisting properties should return changed object");
70
+ t.end();
65
71
  });
66
- test("updateWith", function (t) {
67
- t.deepEqual(updateWith({
68
- id: 2
69
- }, {
70
- count: inc,
71
- other: 2
72
- }, [{
73
- id: 1
74
- }, {
75
- id: 2,
76
- count: 1
77
- }]), [{
78
- id: 1
79
- }, {
80
- id: 2,
81
- count: 2,
82
- other: 2
83
- }], "Mutating item inside array should return new array with changed object");
84
- t.end();
72
+ test("updateWith", function(t) {
73
+ t.deepEqual(updateWith({
74
+ id: 2
75
+ }, {
76
+ count: inc,
77
+ other: 2
78
+ }, [
79
+ {
80
+ id: 1
81
+ },
82
+ {
83
+ id: 2,
84
+ count: 1
85
+ }
86
+ ]), [
87
+ {
88
+ id: 1
89
+ },
90
+ {
91
+ id: 2,
92
+ count: 2,
93
+ other: 2
94
+ }
95
+ ], "Mutating item inside array should return new array with changed object");
96
+ t.end();
85
97
  });
98
+
86
99
  //# sourceMappingURL=update.test.js.map