@asd14/m 7.4.0 → 7.7.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (380) hide show
  1. package/README.md +38 -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 -13
  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 +47 -38
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/rename-file/rename-file.test.js"],"names":["test","renameFile","t","equals","end"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,MAAjB;AAEA,SAASC,UAAT,QAA2B,kBAA3B;AAEAD,IAAI,CAAC,YAAD,EAAe,UAAAE,CAAC,EAAI;AACtBA,EAAAA,CAAC,CAACC,MAAF,CACEF,UAAU,CAAC,OAAD,CAAV,CAAoB,kBAApB,CADF,EAEE,kBAFF,EAGE,4BAHF;AAMAC,EAAAA,CAAC,CAACC,MAAF,CACEF,UAAU,CAAC,OAAD,CAAV,CAAoB,mBAApB,CADF,EAEE,kBAFF,EAGE,yCAHF;AAMAC,EAAAA,CAAC,CAACC,MAAF,CACEF,UAAU,CAAC,QAAD,CAAV,CAAqB,mBAArB,CADF,EAEE,kBAFF,EAGE,2DAHF;AAMAC,EAAAA,CAAC,CAACC,MAAF,CACEF,UAAU,CAAC,QAAD,CAAV,CAAqB,kBAArB,CADF,EAEE,kBAFF,EAGE,kDAHF;AAMAC,EAAAA,CAAC,CAACC,MAAF,CACEF,UAAU,CAAC,OAAD,CAAV,CAAoB,OAApB,CADF,EAEE,OAFF,EAGE,gCAHF;AAMAC,EAAAA,CAAC,CAACC,MAAF,CACEF,UAAU,CAAC,OAAD,CAAV,CAAoBA,UAAU,CAAC,OAAD,CAAV,CAAoB,aAApB,CAApB,CADF,EAEE,cAFF,EAGE,YAHF;AAKAC,EAAAA,CAAC,CAACE,GAAF;AACD,CArCG,CAAJ","sourcesContent":["import test from \"tape\"\n\nimport { renameFile } from \"./rename-file.js\"\n\ntest(\"renameFile\", t => {\n t.equals(\n renameFile(\"ipsum\")(\"/home/user/lorem\"),\n \"/home/user/ipsum\",\n \"Rename file with full path\"\n )\n\n t.equals(\n renameFile(\"ipsum\")(\"/home/user/lorem/\"),\n \"/home/user/ipsum\",\n \"Rename file with trailing slash in path\"\n )\n\n t.equals(\n renameFile(\"ipsum/\")(\"/home/user/lorem/\"),\n \"/home/user/ipsum\",\n \"Rename file with trailing slash in path and new file name\"\n )\n\n t.equals(\n renameFile(\"/ipsum\")(\"/home/user/lorem\"),\n \"/home/user/ipsum\",\n \"Rename file with trailing slash in new file name\"\n )\n\n t.equals(\n renameFile(\"ipsum\")(\"lorem\"),\n \"ipsum\",\n \"Rename file with only fileName\"\n )\n\n t.equals(\n renameFile(\"ipsum\")(renameFile(\"ipsum\")(\"/lorem/test\")),\n \"/lorem/ipsum\",\n \"Idempotent\"\n )\n t.end()\n})\n"],"file":"rename-file.test.js"}
1
+ {"version":3,"sources":["../../src/rename-file/rename-file.test.js"],"sourcesContent":["import test from \"tape\"\n\nimport { renameFile } from \"./rename-file.js\"\n\ntest(\"renameFile\", t => {\n t.equals(\n renameFile(\"ipsum\")(\"/home/user/lorem\"),\n \"/home/user/ipsum\",\n \"Rename file with full path\"\n )\n\n t.equals(\n renameFile(\"ipsum\")(\"/home/user/lorem/\"),\n \"/home/user/ipsum\",\n \"Rename file with trailing slash in path\"\n )\n\n t.equals(\n renameFile(\"ipsum/\")(\"/home/user/lorem/\"),\n \"/home/user/ipsum\",\n \"Rename file with trailing slash in path and new file name\"\n )\n\n t.equals(\n renameFile(\"/ipsum\")(\"/home/user/lorem\"),\n \"/home/user/ipsum\",\n \"Rename file with trailing slash in new file name\"\n )\n\n t.equals(\n renameFile(\"ipsum\")(\"lorem\"),\n \"ipsum\",\n \"Rename file with only fileName\"\n )\n\n t.equals(\n renameFile(\"ipsum\")(renameFile(\"ipsum\")(\"/lorem/test\")),\n \"/lorem/ipsum\",\n \"Idempotent\"\n )\n t.end()\n})\n"],"names":["test","renameFile","t","equals","end"],"mappings":"AAAA,MAAM,CAACA,IAAI,MAAM,CAAM;AAEvB,MAAM,GAAGC,UAAU,QAAQ,CAAkB;AAE7CD,IAAI,CAAC,CAAY,aAAEE,QAClB,CADkBA,CAAC,EAAI,CAAC;IACvBA,CAAC,CAACC,MAAM,CACNF,UAAU,CAAC,CAAO,QAAE,CAAkB,oBACtC,CAAkB,mBAClB,CAA4B;IAG9BC,CAAC,CAACC,MAAM,CACNF,UAAU,CAAC,CAAO,QAAE,CAAmB,qBACvC,CAAkB,mBAClB,CAAyC;IAG3CC,CAAC,CAACC,MAAM,CACNF,UAAU,CAAC,CAAQ,SAAE,CAAmB,qBACxC,CAAkB,mBAClB,CAA2D;IAG7DC,CAAC,CAACC,MAAM,CACNF,UAAU,CAAC,CAAQ,SAAE,CAAkB,oBACvC,CAAkB,mBAClB,CAAkD;IAGpDC,CAAC,CAACC,MAAM,CACNF,UAAU,CAAC,CAAO,QAAE,CAAO,SAC3B,CAAO,QACP,CAAgC;IAGlCC,CAAC,CAACC,MAAM,CACNF,UAAU,CAAC,CAAO,QAAEA,UAAU,CAAC,CAAO,QAAE,CAAa,gBACrD,CAAc,eACd,CAAY;IAEdC,CAAC,CAACE,GAAG;AACP,CAAC"}
@@ -1,17 +1,14 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
1
+ import * as swcHelpers from "@swc/helpers";
2
2
  import { pipe } from "../pipe/pipe.js";
3
-
4
- var _repeat = function _repeat(_fn) {
5
- var count = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
6
- var result = [];
7
- var fn = Array.isArray(_fn) ? pipe.apply(void 0, _toConsumableArray(_fn)) : _fn;
8
- var isFunction = typeof fn === "function";
9
-
10
- for (var i = 0; i < count; i++) {
11
- result.push(isFunction ? fn(i, result) : fn);
12
- }
13
-
14
- return result;
3
+ var _repeat = function(_fn) {
4
+ var count = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
5
+ var result = [];
6
+ var fn = Array.isArray(_fn) ? pipe.apply(void 0, swcHelpers.toConsumableArray(_fn)) : _fn;
7
+ var isFunction = typeof fn === "function";
8
+ for(var i = 0; i < count; i++){
9
+ result.push(isFunction ? fn(i, result) : fn);
10
+ }
11
+ return result;
15
12
  };
16
13
  /**
17
14
  * Return an array of fixed size containing a specified value or function result
@@ -32,22 +29,18 @@ var _repeat = function _repeat(_fn) {
32
29
  *
33
30
  * repeat(index => index + 1, 3)
34
31
  * // => [1, 2, 3]
35
- */
36
-
37
-
38
- export var repeat = function repeat() {
39
- for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
40
- params[_key] = arguments[_key];
41
- }
42
-
43
- // @signature (fn) => (input)
44
- if (params.length <= 1) {
45
- return function (input) {
46
- return _repeat(params[0], input);
47
- };
48
- } // @signature (fn, input)
49
-
50
-
51
- return _repeat.apply(void 0, params);
32
+ */ export var repeat = function() {
33
+ for(var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++){
34
+ params[_key] = arguments[_key];
35
+ }
36
+ // @signature (fn) => (input)
37
+ if (params.length <= 1) {
38
+ return function(input) {
39
+ return _repeat(params[0], input);
40
+ };
41
+ }
42
+ // @signature (fn, input)
43
+ return _repeat.apply(void 0, swcHelpers.toConsumableArray(params));
52
44
  };
45
+
53
46
  //# sourceMappingURL=repeat.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/repeat/repeat.js"],"names":["pipe","_repeat","_fn","count","result","fn","Array","isArray","isFunction","i","push","repeat","params","length","input"],"mappings":";AAAA,SAASA,IAAT,QAAqB,iBAArB;;AAEA,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAACC,GAAD,EAAoB;AAAA,MAAdC,KAAc,uEAAN,CAAM;AAClC,MAAMC,MAAM,GAAG,EAAf;AACA,MAAMC,EAAE,GAAGC,KAAK,CAACC,OAAN,CAAcL,GAAd,IAAqBF,IAAI,MAAJ,4BAAQE,GAAR,EAArB,GAAoCA,GAA/C;AACA,MAAMM,UAAU,GAAG,OAAOH,EAAP,KAAc,UAAjC;;AAEA,OAAK,IAAII,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGN,KAApB,EAA2BM,CAAC,EAA5B,EAAgC;AAC9BL,IAAAA,MAAM,CAACM,IAAP,CAAYF,UAAU,GAAGH,EAAE,CAACI,CAAD,EAAIL,MAAJ,CAAL,GAAmBC,EAAzC;AACD;;AAED,SAAOD,MAAP;AACD,CAVD;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,IAAMO,MAAM,GAAG,SAATA,MAAS,GAAe;AAAA,oCAAXC,MAAW;AAAXA,IAAAA,MAAW;AAAA;;AACnC;AACA,MAAIA,MAAM,CAACC,MAAP,IAAiB,CAArB,EAAwB;AACtB,WAAO,UAAAC,KAAK;AAAA,aAAIb,OAAO,CAACW,MAAM,CAAC,CAAD,CAAP,EAAYE,KAAZ,CAAX;AAAA,KAAZ;AACD,GAJkC,CAMnC;;;AACA,SAAOb,OAAO,MAAP,SAAWW,MAAX,CAAP;AACD,CARM","sourcesContent":["import { pipe } from \"../pipe/pipe.js\"\n\nconst _repeat = (_fn, count = 0) => {\n const result = []\n const fn = Array.isArray(_fn) ? pipe(..._fn) : _fn\n const isFunction = typeof fn === \"function\"\n\n for (let i = 0; i < count; i++) {\n result.push(isFunction ? fn(i, result) : fn)\n }\n\n return result\n}\n\n/**\n * Return an array of fixed size containing a specified value or function result\n *\n * @param {Function|any} fn Function or value to repeat\n * @param {number} input Number of times\n * @param {...any} params Function params\n *\n * @returns {Array}\n *\n * @name repeat\n * @tag Array\n * @signature (fn: Function|any) => (count: Number): Array\n *\n * @example\n * repeat(2)(3)\n * // => [2, 2, 2]\n *\n * repeat(index => index + 1, 3)\n * // => [1, 2, 3]\n */\nexport const repeat = (...params) => {\n // @signature (fn) => (input)\n if (params.length <= 1) {\n return input => _repeat(params[0], input)\n }\n\n // @signature (fn, input)\n return _repeat(...params)\n}\n"],"file":"repeat.js"}
1
+ {"version":3,"sources":["../../src/repeat/repeat.js"],"sourcesContent":["import { pipe } from \"../pipe/pipe.js\"\n\nconst _repeat = (_fn, count = 0) => {\n const result = []\n const fn = Array.isArray(_fn) ? pipe(..._fn) : _fn\n const isFunction = typeof fn === \"function\"\n\n for (let i = 0; i < count; i++) {\n result.push(isFunction ? fn(i, result) : fn)\n }\n\n return result\n}\n\n/**\n * Return an array of fixed size containing a specified value or function result\n *\n * @param {Function|any} fn Function or value to repeat\n * @param {number} input Number of times\n * @param {...any} params Function params\n *\n * @returns {Array}\n *\n * @name repeat\n * @tag Array\n * @signature (fn: Function|any) => (count: Number): Array\n *\n * @example\n * repeat(2)(3)\n * // => [2, 2, 2]\n *\n * repeat(index => index + 1, 3)\n * // => [1, 2, 3]\n */\nexport const repeat = (...params) => {\n // @signature (fn) => (input)\n if (params.length <= 1) {\n return input => _repeat(params[0], input)\n }\n\n // @signature (fn, input)\n return _repeat(...params)\n}\n"],"names":["pipe","_repeat","_fn","count","result","fn","Array","isArray","isFunction","i","push","repeat","params","length","input"],"mappings":";AAAA,MAAM,GAAGA,IAAI,QAAQ,CAAiB;AAEtC,GAAK,CAACC,OAAO,GAAG,QAAQ,CAAPC,GAAG,EAAgB,CAAC;QAAfC,KAAK,oEAAG,CAAC;IAC7B,GAAK,CAACC,MAAM,GAAG,CAAC,CAAC;IACjB,GAAK,CAACC,EAAE,GAAGC,KAAK,CAACC,OAAO,CAACL,GAAG,IAAIF,IAAI,CAAJA,KAAY,CAAZA,IAAI,CAAJA,CAAI,+BAAIE,GAAG,KAAIA,GAAG;IAClD,GAAK,CAACM,UAAU,GAAG,MAAM,CAACH,EAAE,KAAK,CAAU;IAE3C,GAAG,CAAE,GAAG,CAACI,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGN,KAAK,EAAEM,CAAC,GAAI,CAAC;QAC/BL,MAAM,CAACM,IAAI,CAACF,UAAU,GAAGH,EAAE,CAACI,CAAC,EAAEL,MAAM,IAAIC,EAAE;IAC7C,CAAC;IAED,MAAM,CAACD,MAAM;AACf,CAAC;AAED,EAmBG,AAnBH;;;;;;;;;;;;;;;;;;;CAmBG,AAnBH,EAmBG,CACH,MAAM,CAAC,GAAK,CAACO,MAAM,GAAG,QAAQ,GAAO,CAAC;qCAAZC,MAAM;QAANA,MAAM;;IAC9B,EAA6B,AAA7B,2BAA6B;IAC7B,EAAE,EAAEA,MAAM,CAACC,MAAM,IAAI,CAAC,EAAE,CAAC;QACvB,MAAM,CAACC,QAAQ,CAARA,KAAK;YAAIb,MAAM,CAANA,OAAO,CAACW,MAAM,CAAC,CAAC,GAAGE,KAAK;;IAC1C,CAAC;IAED,EAAyB,AAAzB,uBAAyB;IACzB,MAAM,CAACb,OAAO,CAAPA,KAAkB,CAAlBA,IAAI,CAAJA,CAAO,+BAAIW,MAAM;AAC1B,CAAC"}
@@ -1,16 +1,33 @@
1
1
  import test from "tape";
2
2
  import { repeat } from "./repeat.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("repeat", function (t) {
9
- t.deepEqual(repeat(inc)(5), [1, 2, 3, 4, 5], "Repeat function curried");
10
- t.deepEqual(repeat(inc, 2), [1, 2], "Repeat function uncurried ");
11
- t.deepEqual(repeat([inc, inc], 2), [2, 3], "Repeat with function chain");
12
- t.deepEqual(repeat(inc)(), [], "Repeat without count");
13
- t.deepEqual(repeat(3, 2), [3, 3], "Repeat value curried ");
14
- t.end();
6
+ test("repeat", function(t) {
7
+ t.deepEqual(repeat(inc)(5), [
8
+ 1,
9
+ 2,
10
+ 3,
11
+ 4,
12
+ 5
13
+ ], "Repeat function curried");
14
+ t.deepEqual(repeat(inc, 2), [
15
+ 1,
16
+ 2
17
+ ], "Repeat function uncurried ");
18
+ t.deepEqual(repeat([
19
+ inc,
20
+ inc
21
+ ], 2), [
22
+ 2,
23
+ 3
24
+ ], "Repeat with function chain");
25
+ t.deepEqual(repeat(inc)(), [], "Repeat without count");
26
+ t.deepEqual(repeat(3, 2), [
27
+ 3,
28
+ 3
29
+ ], "Repeat value curried ");
30
+ t.end();
15
31
  });
32
+
16
33
  //# sourceMappingURL=repeat.test.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/repeat/repeat.test.js"],"names":["test","repeat","inc","x","t","deepEqual","end"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,MAAjB;AAEA,SAASC,MAAT,QAAuB,aAAvB;;AAEA,IAAMC,GAAG,GAAG,SAANA,GAAM,CAAAC,CAAC;AAAA,SAAIA,CAAC,GAAG,CAAR;AAAA,CAAb;;AAEAH,IAAI,CAAC,QAAD,EAAW,UAAAI,CAAC,EAAI;AAClBA,EAAAA,CAAC,CAACC,SAAF,CAAYJ,MAAM,CAACC,GAAD,CAAN,CAAY,CAAZ,CAAZ,EAA4B,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,EAAa,CAAb,CAA5B,EAA6C,yBAA7C;AACAE,EAAAA,CAAC,CAACC,SAAF,CAAYJ,MAAM,CAACC,GAAD,EAAM,CAAN,CAAlB,EAA4B,CAAC,CAAD,EAAI,CAAJ,CAA5B,EAAoC,4BAApC;AACAE,EAAAA,CAAC,CAACC,SAAF,CAAYJ,MAAM,CAAC,CAACC,GAAD,EAAMA,GAAN,CAAD,EAAa,CAAb,CAAlB,EAAmC,CAAC,CAAD,EAAI,CAAJ,CAAnC,EAA2C,4BAA3C;AAEAE,EAAAA,CAAC,CAACC,SAAF,CAAYJ,MAAM,CAACC,GAAD,CAAN,EAAZ,EAA2B,EAA3B,EAA+B,sBAA/B;AACAE,EAAAA,CAAC,CAACC,SAAF,CAAYJ,MAAM,CAAC,CAAD,EAAI,CAAJ,CAAlB,EAA0B,CAAC,CAAD,EAAI,CAAJ,CAA1B,EAAkC,uBAAlC;AAEAG,EAAAA,CAAC,CAACE,GAAF;AACD,CATG,CAAJ","sourcesContent":["import test from \"tape\"\n\nimport { repeat } from \"./repeat.js\"\n\nconst inc = x => x + 1\n\ntest(\"repeat\", t => {\n t.deepEqual(repeat(inc)(5), [1, 2, 3, 4, 5], \"Repeat function curried\")\n t.deepEqual(repeat(inc, 2), [1, 2], \"Repeat function uncurried \")\n t.deepEqual(repeat([inc, inc], 2), [2, 3], \"Repeat with function chain\")\n\n t.deepEqual(repeat(inc)(), [], \"Repeat without count\")\n t.deepEqual(repeat(3, 2), [3, 3], \"Repeat value curried \")\n\n t.end()\n})\n"],"file":"repeat.test.js"}
1
+ {"version":3,"sources":["../../src/repeat/repeat.test.js"],"sourcesContent":["import test from \"tape\"\n\nimport { repeat } from \"./repeat.js\"\n\nconst inc = x => x + 1\n\ntest(\"repeat\", t => {\n t.deepEqual(repeat(inc)(5), [1, 2, 3, 4, 5], \"Repeat function curried\")\n t.deepEqual(repeat(inc, 2), [1, 2], \"Repeat function uncurried \")\n t.deepEqual(repeat([inc, inc], 2), [2, 3], \"Repeat with function chain\")\n\n t.deepEqual(repeat(inc)(), [], \"Repeat without count\")\n t.deepEqual(repeat(3, 2), [3, 3], \"Repeat value curried \")\n\n t.end()\n})\n"],"names":["test","repeat","inc","x","t","deepEqual","end"],"mappings":"AAAA,MAAM,CAACA,IAAI,MAAM,CAAM;AAEvB,MAAM,GAAGC,MAAM,QAAQ,CAAa;AAEpC,GAAK,CAACC,GAAG,GAAGC,QAAQ,CAARA,CAAC;IAAIA,MACjB,CADiBA,CAAC,GAAG,CAAC;;AAEtBH,IAAI,CAAC,CAAQ,SAAEI,QACd,CADcA,CAAC,EAAI,CAAC;IACnBA,CAAC,CAACC,SAAS,CAACJ,MAAM,CAACC,GAAG,EAAE,CAAC,GAAG,CAAC;AAAA,SAAC;AAAE,SAAC;AAAE,SAAC;AAAE,SAAC;AAAE,SAAC;IAAA,CAAC,EAAE,CAAyB;IACtEE,CAAC,CAACC,SAAS,CAACJ,MAAM,CAACC,GAAG,EAAE,CAAC,GAAG,CAAC;AAAA,SAAC;AAAE,SAAC;IAAA,CAAC,EAAE,CAA4B;IAChEE,CAAC,CAACC,SAAS,CAACJ,MAAM,CAAC,CAACC;QAAAA,GAAG;QAAEA,GAAG;IAAA,CAAC,EAAE,CAAC,GAAG,CAAC;AAAA,SAAC;AAAE,SAAC;IAAA,CAAC,EAAE,CAA4B;IAEvEE,CAAC,CAACC,SAAS,CAACJ,MAAM,CAACC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAsB;IACrDE,CAAC,CAACC,SAAS,CAACJ,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC;AAAA,SAAC;AAAE,SAAC;IAAA,CAAC,EAAE,CAAuB;IAEzDG,CAAC,CAACE,GAAG;AACP,CAAC"}
@@ -8,12 +8,10 @@ import { type } from "../type/type.js";
8
8
  * @param {string} newString The new string
9
9
  *
10
10
  * @returns {string}
11
- */
12
-
13
- var replaceString = function replaceString(oldString, newString) {
14
- return function (input) {
15
- return String.prototype.replace.call(input, oldString, newString);
16
- };
11
+ */ var replaceString = function(oldString, newString) {
12
+ return function(input) {
13
+ return String.prototype.replace.call(input, oldString, newString);
14
+ };
17
15
  };
18
16
  /**
19
17
  * Replace element in array (shallow equal)
@@ -22,23 +20,18 @@ var replaceString = function replaceString(oldString, newString) {
22
20
  * @param {any} newElm
23
21
  *
24
22
  * @returns {Array}
25
- */
26
-
27
-
28
- var replaceArray = function replaceArray(oldElm, newElm) {
29
- return function (input) {
30
- var result = [];
31
-
32
- for (var i = 0, length = input.length - 1; i <= length; i++) {
33
- if (oldElm === input[i]) {
34
- result.push(newElm);
35
- } else {
36
- result.push(input[i]);
37
- }
38
- }
39
-
40
- return result;
41
- };
23
+ */ var replaceArray = function(oldElm, newElm) {
24
+ return function(input) {
25
+ var result = [];
26
+ for(var i = 0, length = input.length - 1; i <= length; i++){
27
+ if (oldElm === input[i]) {
28
+ result.push(newElm);
29
+ } else {
30
+ result.push(input[i]);
31
+ }
32
+ }
33
+ return result;
34
+ };
42
35
  };
43
36
  /**
44
37
  * Replace substring if source is string, replace element (shallow equal) if
@@ -53,18 +46,15 @@ var replaceArray = function replaceArray(oldElm, newElm) {
53
46
  * @tag String,Array
54
47
  * @signature (oldElm: string|any, newElm: string|any) => (source: Array): Array
55
48
  *
56
- */
57
-
58
-
59
- var replace = function replace(oldElm, newElm) {
60
- return function (input) {
61
- var inputType = type(input);
62
- var byType = {
63
- String: replaceString,
64
- Array: replaceArray
49
+ */ var replace = function(oldElm, newElm) {
50
+ return function(input) {
51
+ var inputType = type(input);
52
+ var byType = {
53
+ String: replaceString,
54
+ Array: replaceArray
55
+ };
56
+ return byType[inputType](oldElm, newElm)(input);
65
57
  };
66
- return byType[inputType](oldElm, newElm)(input);
67
- };
68
58
  };
69
59
  /**
70
60
  * Replace object element in array using filter object
@@ -102,14 +92,11 @@ var replace = function replace(oldElm, newElm) {
102
92
  * // { id: 1, name: "foo", content: [] },
103
93
  * // { id: 2, name: "bar", content: ["new", "updated", "field"] },
104
94
  * // ],
105
- */
106
-
107
-
108
- var replaceWith = function replaceWith(filter, newValue) {
109
- return map(function (item) {
110
- return isMatch(filter)(item) ? typeof newValue === "function" ? newValue(item) : newValue : item;
111
- });
95
+ */ var replaceWith = function(filter, newValue) {
96
+ return map(function(item) {
97
+ return isMatch(filter)(item) ? typeof newValue === "function" ? newValue(item) : newValue : item;
98
+ });
112
99
  };
113
-
114
100
  export { replace, replaceWith };
101
+
115
102
  //# sourceMappingURL=replace.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/replace/replace.js"],"names":["map","isMatch","type","replaceString","oldString","newString","input","String","prototype","replace","call","replaceArray","oldElm","newElm","result","i","length","push","inputType","byType","Array","replaceWith","filter","newValue","item"],"mappings":"AAAA,SAASA,GAAT,QAAoB,eAApB;AACA,SAASC,OAAT,QAAwB,yBAAxB;AACA,SAASC,IAAT,QAAqB,iBAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAACC,SAAD,EAAYC,SAAZ;AAAA,SAA0B,UAAAC,KAAK;AAAA,WACnDC,MAAM,CAACC,SAAP,CAAiBC,OAAjB,CAAyBC,IAAzB,CAA8BJ,KAA9B,EAAqCF,SAArC,EAAgDC,SAAhD,CADmD;A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AACC,MAAD,EAASC,QAAT;AAAA,SAClBvB,GAAG,CAAC,UAAAwB,IAAI;AAAA,WACNvB,OAAO,CAACqB,MAAD,CAAP,CAAgBE,IAAhB,IACI,OAAOD,QAAP,KAAoB,UAApB,GACEA,QAAQ,CAACC,IAAD,CADV,GAEED,QAHN,GAIIC,IALE;AAAA,GAAL,CADe;AAAA,CAApB;;AASA,SAASf,OAAT,EAAkBY,WAAlB","sourcesContent":["import { map } from \"../map/map.js\"\nimport { isMatch } from \"../is-match/is-match.js\"\nimport { type } from \"../type/type.js\"\n\n/**\n * Replace substring in string\n *\n * @param {string} oldString The old string\n * @param {string} newString The new string\n *\n * @returns {string}\n */\nconst replaceString = (oldString, newString) => input =>\n String.prototype.replace.call(input, oldString, newString)\n\n/**\n * Replace element in array (shallow equal)\n *\n * @param {any} oldElm\n * @param {any} newElm\n *\n * @returns {Array}\n */\nconst replaceArray = (oldElm, newElm) => input => {\n const result = []\n\n for (let i = 0, length = input.length - 1; i <= length; i++) {\n if (oldElm === input[i]) {\n result.push(newElm)\n } else {\n result.push(input[i])\n }\n }\n\n return result\n}\n\n/**\n * Replace substring if source is string, replace element (shallow equal) if\n * source is Array\n *\n * @param {string|any} oldElm\n * @param {string|any} newElm\n * @param {string|Array} source\n *\n * @returns {string|Array}\n *\n * @tag String,Array\n * @signature (oldElm: string|any, newElm: string|any) => (source: Array): Array\n *\n */\nconst replace = (oldElm, newElm) => input => {\n const inputType = type(input)\n const byType = {\n String: replaceString,\n Array: replaceArray,\n }\n\n return byType[inputType](oldElm, newElm)(input)\n}\n\n/**\n * Replace object element in array using filter object\n *\n * @tag Array\n * @signature (filter: Obj, replace: Obj|Function) => (source: Obj[]): Obj[]\n *\n * @param {Object} filter Filter object to match against each element\n * @param {Object} newValue Object to replace matching elements\n * @param {Object[]} source\n *\n * @returns {Array}\n *\n * @example\n * replaceWith(\n * {id: 2},\n * {id: 2, title: \"boss\", isBoss: true}\n * )([\n * {id: 2, title:\"minion\"}\n * {id: 3, title:\"minion\"}\n * ])\n * // => [\n * // {id: 2, title:\"boss\", isBoss: true},\n * // {id: 3, title:\"minion\"}\n * // ]\n *\n * replaceWith({ id: 2 }, item => ({\n * ...item,\n * content: [\"new\", \"updated\", \"field\"],\n * }))([\n * { id: 1, name: \"foo\", content: [] },\n * { id: 2, name: \"bar\", content: [] },\n * ])\n * // [\n * // { id: 1, name: \"foo\", content: [] },\n * // { id: 2, name: \"bar\", content: [\"new\", \"updated\", \"field\"] },\n * // ],\n */\nconst replaceWith = (filter, newValue) =>\n map(item =>\n isMatch(filter)(item)\n ? typeof newValue === \"function\"\n ? newValue(item)\n : newValue\n : item\n )\n\nexport { replace, replaceWith }\n"],"file":"replace.js"}
1
+ {"version":3,"sources":["../../src/replace/replace.js"],"sourcesContent":["import { map } from \"../map/map.js\"\nimport { isMatch } from \"../is-match/is-match.js\"\nimport { type } from \"../type/type.js\"\n\n/**\n * Replace substring in string\n *\n * @param {string} oldString The old string\n * @param {string} newString The new string\n *\n * @returns {string}\n */\nconst replaceString = (oldString, newString) => input =>\n String.prototype.replace.call(input, oldString, newString)\n\n/**\n * Replace element in array (shallow equal)\n *\n * @param {any} oldElm\n * @param {any} newElm\n *\n * @returns {Array}\n */\nconst replaceArray = (oldElm, newElm) => input => {\n const result = []\n\n for (let i = 0, length = input.length - 1; i <= length; i++) {\n if (oldElm === input[i]) {\n result.push(newElm)\n } else {\n result.push(input[i])\n }\n }\n\n return result\n}\n\n/**\n * Replace substring if source is string, replace element (shallow equal) if\n * source is Array\n *\n * @param {string|any} oldElm\n * @param {string|any} newElm\n * @param {string|Array} source\n *\n * @returns {string|Array}\n *\n * @tag String,Array\n * @signature (oldElm: string|any, newElm: string|any) => (source: Array): Array\n *\n */\nconst replace = (oldElm, newElm) => input => {\n const inputType = type(input)\n const byType = {\n String: replaceString,\n Array: replaceArray,\n }\n\n return byType[inputType](oldElm, newElm)(input)\n}\n\n/**\n * Replace object element in array using filter object\n *\n * @tag Array\n * @signature (filter: Obj, replace: Obj|Function) => (source: Obj[]): Obj[]\n *\n * @param {Object} filter Filter object to match against each element\n * @param {Object} newValue Object to replace matching elements\n * @param {Object[]} source\n *\n * @returns {Array}\n *\n * @example\n * replaceWith(\n * {id: 2},\n * {id: 2, title: \"boss\", isBoss: true}\n * )([\n * {id: 2, title:\"minion\"}\n * {id: 3, title:\"minion\"}\n * ])\n * // => [\n * // {id: 2, title:\"boss\", isBoss: true},\n * // {id: 3, title:\"minion\"}\n * // ]\n *\n * replaceWith({ id: 2 }, item => ({\n * ...item,\n * content: [\"new\", \"updated\", \"field\"],\n * }))([\n * { id: 1, name: \"foo\", content: [] },\n * { id: 2, name: \"bar\", content: [] },\n * ])\n * // [\n * // { id: 1, name: \"foo\", content: [] },\n * // { id: 2, name: \"bar\", content: [\"new\", \"updated\", \"field\"] },\n * // ],\n */\nconst replaceWith = (filter, newValue) =>\n map(item =>\n isMatch(filter)(item)\n ? typeof newValue === \"function\"\n ? newValue(item)\n : newValue\n : item\n )\n\nexport { replace, replaceWith }\n"],"names":["map","isMatch","type","replaceString","oldString","newString","input","String","prototype","replace","call","replaceArray","oldElm","newElm","result","i","length","push","inputType","byType","Array","replaceWith","filter","newValue","item"],"mappings":"AAAA,MAAM,GAAGA,GAAG,QAAQ,CAAe;AACnC,MAAM,GAAGC,OAAO,QAAQ,CAAyB;AACjD,MAAM,GAAGC,IAAI,QAAQ,CAAiB;AAEtC,EAOG,AAPH;;;;;;;CAOG,AAPH,EAOG,CACH,GAAK,CAACC,aAAa,GAAG,QAAQ,CAAPC,SAAS,EAAEC,SAAS;IAAKC,MAAM,CAANA,QAAQ,CAARA,KAAK;QACnDC,MAAM,CAANA,MAAM,CAACC,SAAS,CAACC,OAAO,CAACC,IAAI,CAACJ,KAAK,EAAEF,SAAS,EAAEC,SAAS;;;AAE3D,EAOG,AAPH;;;;;;;CAOG,AAPH,EAOG,CACH,GAAK,CAACM,YAAY,GAAG,QAAQ,CAAPC,MAAM,EAAEC,MAAM;IAAKP,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AGf,OAAO,EAAEY,WAAW"}
@@ -1,86 +1,131 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
- 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; }
4
-
5
- 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; }
6
-
1
+ import * as swcHelpers from "@swc/helpers";
7
2
  import test from "tape";
8
3
  import { replace, replaceWith } from "./replace.js";
9
- test("replace(With)", function (t) {
10
- t.equals(replace("test", "ipsum")("lorem test"), "lorem ipsum", "Replace substring in string");
11
- t.equals(replace("testx", "ipsum")("lorem test"), "lorem test", "Replacement string does not exist");
12
- t.deepEquals(replace("test", "ipsum")(["lorem", "test"]), ["lorem", "ipsum"], "Replace string element in array source");
13
- t.deepEquals(replace("testx", "ipsum")(["lorem", "test"]), ["lorem", "test"], "Replacement string does not exist in array source");
14
- var input = ["lorem", "test"];
15
- t.notEquals(replace("test", "ipsum")(input), input, "Imutable");
16
- t.deepEquals(replace("test", "ipsum")(replace("test", "ipsum")(["lorem", "test"])), ["lorem", "ipsum"], "Idempotent");
17
- t.deepEqual(replaceWith({
18
- id: 2
19
- }, {
20
- id: 2,
21
- title: "boss",
22
- isBoss: true
23
- })([{
24
- id: 2,
25
- title: "minion"
26
- }, {
27
- id: 3,
28
- title: "minion"
29
- }]), [{
30
- id: 2,
31
- title: "boss",
32
- isBoss: true
33
- }, {
34
- id: 3,
35
- title: "minion"
36
- }], "Replace existing object");
37
- t.deepEqual(replaceWith({
38
- "!name": "alice"
39
- }, {
40
- name: "bobby",
41
- title: "tables"
42
- })([{
43
- name: "alice",
44
- title: "first"
45
- }, {
46
- name: "bob",
47
- title: "second"
48
- }, {
49
- name: "george",
50
- title: "third"
51
- }]), [{
52
- name: "alice",
53
- title: "first"
54
- }, {
55
- name: "bobby",
56
- title: "tables"
57
- }, {
58
- name: "bobby",
59
- title: "tables"
60
- }], "Replace multiple objects by using negate in filter object");
61
- t.deepEquals(replaceWith({
62
- id: 2
63
- }, function (item) {
64
- return _objectSpread(_objectSpread({}, item), {}, {
65
- content: ["new", "updated", "field"]
66
- });
67
- })([{
68
- id: 1,
69
- name: "foo",
70
- content: []
71
- }, {
72
- id: 2,
73
- name: "bar",
74
- content: []
75
- }]), [{
76
- id: 1,
77
- name: "foo",
78
- content: []
79
- }, {
80
- id: 2,
81
- name: "bar",
82
- content: ["new", "updated", "field"]
83
- }], "Replace object with custom update function");
84
- t.end();
4
+ test("replace(With)", function(t) {
5
+ t.equals(replace("test", "ipsum")("lorem test"), "lorem ipsum", "Replace substring in string");
6
+ t.equals(replace("testx", "ipsum")("lorem test"), "lorem test", "Replacement string does not exist");
7
+ t.deepEquals(replace("test", "ipsum")([
8
+ "lorem",
9
+ "test"
10
+ ]), [
11
+ "lorem",
12
+ "ipsum"
13
+ ], "Replace string element in array source");
14
+ t.deepEquals(replace("testx", "ipsum")([
15
+ "lorem",
16
+ "test"
17
+ ]), [
18
+ "lorem",
19
+ "test"
20
+ ], "Replacement string does not exist in array source");
21
+ var input = [
22
+ "lorem",
23
+ "test"
24
+ ];
25
+ t.notEquals(replace("test", "ipsum")(input), input, "Imutable");
26
+ t.deepEquals(replace("test", "ipsum")(replace("test", "ipsum")([
27
+ "lorem",
28
+ "test"
29
+ ])), [
30
+ "lorem",
31
+ "ipsum"
32
+ ], "Idempotent");
33
+ t.deepEqual(replaceWith({
34
+ id: 2
35
+ }, {
36
+ id: 2,
37
+ title: "boss",
38
+ isBoss: true
39
+ })([
40
+ {
41
+ id: 2,
42
+ title: "minion"
43
+ },
44
+ {
45
+ id: 3,
46
+ title: "minion"
47
+ },
48
+ ]), [
49
+ {
50
+ id: 2,
51
+ title: "boss",
52
+ isBoss: true
53
+ },
54
+ {
55
+ id: 3,
56
+ title: "minion"
57
+ },
58
+ ], "Replace existing object");
59
+ t.deepEqual(replaceWith({
60
+ "!name": "alice"
61
+ }, {
62
+ name: "bobby",
63
+ title: "tables"
64
+ })([
65
+ {
66
+ name: "alice",
67
+ title: "first"
68
+ },
69
+ {
70
+ name: "bob",
71
+ title: "second"
72
+ },
73
+ {
74
+ name: "george",
75
+ title: "third"
76
+ },
77
+ ]), [
78
+ {
79
+ name: "alice",
80
+ title: "first"
81
+ },
82
+ {
83
+ name: "bobby",
84
+ title: "tables"
85
+ },
86
+ {
87
+ name: "bobby",
88
+ title: "tables"
89
+ },
90
+ ], "Replace multiple objects by using negate in filter object");
91
+ t.deepEquals(replaceWith({
92
+ id: 2
93
+ }, function(item) {
94
+ return swcHelpers.objectSpread({}, item, {
95
+ content: [
96
+ "new",
97
+ "updated",
98
+ "field"
99
+ ]
100
+ });
101
+ })([
102
+ {
103
+ id: 1,
104
+ name: "foo",
105
+ content: []
106
+ },
107
+ {
108
+ id: 2,
109
+ name: "bar",
110
+ content: []
111
+ },
112
+ ]), [
113
+ {
114
+ id: 1,
115
+ name: "foo",
116
+ content: []
117
+ },
118
+ {
119
+ id: 2,
120
+ name: "bar",
121
+ content: [
122
+ "new",
123
+ "updated",
124
+ "field"
125
+ ]
126
+ },
127
+ ], "Replace object with custom update function");
128
+ t.end();
85
129
  });
130
+
86
131
  //# sourceMappingURL=replace.test.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/replace/replace.test.js"],"names":["test","replace","replaceWith","t","equals","deepEquals","input","notEquals","deepEqual","id","title","isBoss","name","item","content","end"],"mappings":";;;;;;AAAA,OAAOA,IAAP,MA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AEzBC,MAAAA,OAAO,EAAE,CAAC,KAAD,EAAQ,SAAR,EAAmB,OAAnB;AAFgB;AAAA,GAAhB,CAAX,CAGI,CACF;AAAEL,IAAAA,EAAE,EAAE,CAAN;AAASG,IAAAA,IAAI,EAAE,KAAf;AAAsBE,IAAAA,OAAO,EAAE;AAA/B,GADE,EAEF;AAAEL,IAAAA,EAAE,EAAE,CAAN;AAASG,IAAAA,IAAI,EAAE,KAAf;AAAsBE,IAAAA,OAAO,EAAE;AAA/B,GAFE,CAHJ,CADF,EAQE,CACE;AAAEL,IAAAA,EAAE,EAAE,CAAN;AAASG,IAAAA,IAAI,EAAE,KAAf;AAAsBE,IAAAA,OAAO,EAAE;AAA/B,GADF,EAEE;AAAEL,IAAAA,EAAE,EAAE,CAAN;AAASG,IAAAA,IAAI,EAAE,KAAf;AAAsBE,IAAAA,OAAO,EAAE,CAAC,KAAD,EAAQ,SAAR,EAAmB,OAAnB;AAA/B,GAFF,CARF,EAYE,4CAZF;AAeAX,EAAAA,CAAC,CAACY,GAAF;AACD,CAnFG,CAAJ","sourcesContent":["import test from \"tape\"\nimport { replace, replaceWith } from \"./replace.js\"\n\ntest(\"replace(With)\", t => {\n t.equals(\n replace(\"test\", \"ipsum\")(\"lorem test\"),\n \"lorem ipsum\",\n \"Replace substring in string\"\n )\n\n t.equals(\n replace(\"testx\", \"ipsum\")(\"lorem test\"),\n \"lorem test\",\n \"Replacement string does not exist\"\n )\n\n t.deepEquals(\n replace(\"test\", \"ipsum\")([\"lorem\", \"test\"]),\n [\"lorem\", \"ipsum\"],\n \"Replace string element in array source\"\n )\n\n t.deepEquals(\n replace(\"testx\", \"ipsum\")([\"lorem\", \"test\"]),\n [\"lorem\", \"test\"],\n \"Replacement string does not exist in array source\"\n )\n\n const input = [\"lorem\", \"test\"]\n\n t.notEquals(replace(\"test\", \"ipsum\")(input), input, \"Imutable\")\n\n t.deepEquals(\n replace(\"test\", \"ipsum\")(replace(\"test\", \"ipsum\")([\"lorem\", \"test\"])),\n [\"lorem\", \"ipsum\"],\n \"Idempotent\"\n )\n\n t.deepEqual(\n replaceWith(\n { id: 2 },\n { id: 2, title: \"boss\", isBoss: true }\n )([\n { id: 2, title: \"minion\" },\n { id: 3, title: \"minion\" },\n ]),\n [\n { id: 2, title: \"boss\", isBoss: true },\n { id: 3, title: \"minion\" },\n ],\n \"Replace existing object\"\n )\n\n t.deepEqual(\n replaceWith(\n { \"!name\": \"alice\" },\n { name: \"bobby\", title: \"tables\" }\n )([\n { name: \"alice\", title: \"first\" },\n { name: \"bob\", title: \"second\" },\n { name: \"george\", title: \"third\" },\n ]),\n [\n { name: \"alice\", title: \"first\" },\n { name: \"bobby\", title: \"tables\" },\n { name: \"bobby\", title: \"tables\" },\n ],\n \"Replace multiple objects by using negate in filter object\"\n )\n\n t.deepEquals(\n replaceWith({ id: 2 }, item => ({\n ...item,\n content: [\"new\", \"updated\", \"field\"],\n }))([\n { id: 1, name: \"foo\", content: [] },\n { id: 2, name: \"bar\", content: [] },\n ]),\n [\n { id: 1, name: \"foo\", content: [] },\n { id: 2, name: \"bar\", content: [\"new\", \"updated\", \"field\"] },\n ],\n \"Replace object with custom update function\"\n )\n\n t.end()\n})\n"],"file":"replace.test.js"}
1
+ {"version":3,"sources":["../../src/replace/replace.test.js"],"sourcesContent":["import test from \"tape\"\nimport { replace, replaceWith } from \"./replace.js\"\n\ntest(\"replace(With)\", t => {\n t.equals(\n replace(\"test\", \"ipsum\")(\"lorem test\"),\n \"lorem ipsum\",\n \"Replace substring in string\"\n )\n\n t.equals(\n replace(\"testx\", \"ipsum\")(\"lorem test\"),\n \"lorem test\",\n \"Replacement string does not exist\"\n )\n\n t.deepEquals(\n replace(\"test\", \"ipsum\")([\"lorem\", \"test\"]),\n [\"lorem\", \"ipsum\"],\n \"Replace string element in array source\"\n )\n\n t.deepEquals(\n replace(\"testx\", \"ipsum\")([\"lorem\", \"test\"]),\n [\"lorem\", \"test\"],\n \"Replacement string does not exist in array source\"\n )\n\n const input = [\"lorem\", \"test\"]\n\n t.notEquals(replace(\"test\", \"ipsum\")(input), input, \"Imutable\")\n\n t.deepEquals(\n replace(\"test\", \"ipsum\")(replace(\"test\", \"ipsum\")([\"lorem\", \"test\"])),\n [\"lorem\", \"ipsum\"],\n \"Idempotent\"\n )\n\n t.deepEqual(\n replaceWith(\n { id: 2 },\n { id: 2, title: \"boss\", isBoss: true }\n )([\n { id: 2, title: \"minion\" },\n { id: 3, title: \"minion\" },\n ]),\n [\n { id: 2, title: \"boss\", isBoss: true },\n { id: 3, title: \"minion\" },\n ],\n \"Replace existing object\"\n )\n\n t.deepEqual(\n replaceWith(\n { \"!name\": \"alice\" },\n { name: \"bobby\", title: \"tables\" }\n )([\n { name: \"alice\", title: \"first\" },\n { name: \"bob\", title: \"second\" },\n { name: \"george\", title: \"third\" },\n ]),\n [\n { name: \"alice\", title: \"first\" },\n { name: \"bobby\", title: \"tables\" },\n { name: \"bobby\", title: \"tables\" },\n ],\n \"Replace multiple objects by using negate in filter object\"\n )\n\n t.deepEquals(\n replaceWith({ id: 2 }, item => ({\n ...item,\n content: [\"new\", \"updated\", \"field\"],\n }))([\n { id: 1, name: \"foo\", content: [] },\n { id: 2, name: \"bar\", content: [] },\n ]),\n [\n { id: 1, name: \"foo\", content: [] },\n { id: 2, name: \"bar\", content: [\"new\", \"updated\", \"field\"] },\n ],\n \"Replace object with custom update function\"\n )\n\n t.end()\n})\n"],"names":["test","replace","replaceWith","t","equals","deepEquals","input","notEquals","deepEqual","id","title","isBoss","name","item","content","end"],"mappings":";AAAA,MAAM,CAACA,IAAI,MAAM,CAAM;AACvB,MAAM,GAAGC,OAAO,EAAEC,WAAW,QAAQ,CAAc;AAEnDF,IAAI,CAAC,CAAe,gBAAEG,QACrB,CADqBA,CAAC,EAAI,CAAC;IAC1BA,CAAC,CAACC,MAAM,CACNH,OAAO,CAAC,CAAM,OAAE,CAAO,QAAE,CAAY,cACrC,CAAa,cACb,CAA6B;IAG/BE,CAAC,CAACC,MA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C,CAAC;IACrC,CAAC,GACD,CAAC;QACC,CAAC;YAACL,EAAE,EAAE,CAAC;YAAEG,IAAI,EAAE,CAAK;YAAEE,OAAO,EAAE,CAAC,CAAC;QAAC,CAAC;QACnC,CAAC;YAACL,EAAE,EAAE,CAAC;YAAEG,IAAI,EAAE,CAAK;YAAEE,OAAO,EAAE,CAAC;gBAAA,CAAK;gBAAE,CAAS;gBAAE,CAAO;YAAA,CAAC;QAAC,CAAC;IAC9D,CAAC,EACD,CAA4C;IAG9CX,CAAC,CAACY,GAAG;AACP,CAAC"}
package/dist/same/same.js CHANGED
@@ -4,10 +4,10 @@
4
4
  * @param {any} input Something, anything
5
5
  *
6
6
  * @returns {any}
7
- */
8
- export var same = function same(input) {
9
- return function () {
10
- return input;
11
- };
7
+ */ export var same = function(input) {
8
+ return function() {
9
+ return input;
10
+ };
12
11
  };
12
+
13
13
  //# sourceMappingURL=same.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/same/same.js"],"names":["same","input"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMA,IAAI,GAAG,SAAPA,IAAO,CAAAC,KAAK;AAAA,SAAI;AAAA,WAAMA,KAAN;AAAA,GAAJ;AAAA,CAAlB","sourcesContent":["/**\n * Curried funtion that always returns the input given\n *\n * @param {any} input Something, anything\n *\n * @returns {any}\n */\nexport const same = input => () => input\n"],"file":"same.js"}
1
+ {"version":3,"sources":["../../src/same/same.js"],"sourcesContent":["/**\n * Curried funtion that always returns the input given\n *\n * @param {any} input Something, anything\n *\n * @returns {any}\n */\nexport const same = input => () => input\n"],"names":["same","input"],"mappings":"AAAA,EAMG,AANH;;;;;;CAMG,AANH,EAMG,CACH,MAAM,CAAC,GAAK,CAACA,IAAI,GAAGC,QAAQ,CAARA,KAAK;IAAI,MAAMA,CAAN,QAAQ;QAAFA,MAAM,CAANA,KAAK"}
@@ -1,8 +1,9 @@
1
1
  import test from "tape";
2
2
  import { same } from "./same.js";
3
- test("same", function (t) {
4
- var object = {};
5
- t.equals(same(object)(), object, "Give value as input, get the same value in return");
6
- t.end();
3
+ test("same", function(t) {
4
+ var object = {};
5
+ t.equals(same(object)(), object, "Give value as input, get the same value in return");
6
+ t.end();
7
7
  });
8
+
8
9
  //# sourceMappingURL=same.test.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/same/same.test.js"],"names":["test","same","t","object","equals","end"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,MAAjB;AAEA,SAASC,IAAT,QAAqB,WAArB;AAEAD,IAAI,CAAC,MAAD,EAAS,UAAAE,CAAC,EAAI;AAChB,MAAMC,MAAM,GAAG,EAAf;AAEAD,EAAAA,CAAC,CAACE,MAAF,CACEH,IAAI,CAACE,MAAD,CAAJ,EADF,EAEEA,MAFF,EAGE,mDAHF;AAMAD,EAAAA,CAAC,CAACG,GAAF;AACD,CAVG,CAAJ","sourcesContent":["import test from \"tape\"\n\nimport { same } from \"./same.js\"\n\ntest(\"same\", t => {\n const object = {}\n\n t.equals(\n same(object)(),\n object,\n \"Give value as input, get the same value in return\"\n )\n\n t.end()\n})\n"],"file":"same.test.js"}
1
+ {"version":3,"sources":["../../src/same/same.test.js"],"sourcesContent":["import test from \"tape\"\n\nimport { same } from \"./same.js\"\n\ntest(\"same\", t => {\n const object = {}\n\n t.equals(\n same(object)(),\n object,\n \"Give value as input, get the same value in return\"\n )\n\n t.end()\n})\n"],"names":["test","same","t","object","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;IACjB,GAAK,CAACC,MAAM,GAAG,CAAC,CAAC;IAEjBD,CAAC,CAACE,MAAM,CACNH,IAAI,CAACE,MAAM,KACXA,MAAM,EACN,CAAmD;IAGrDD,CAAC,CAACG,GAAG;AACP,CAAC"}