@asd14/m 6.6.0 → 7.3.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 (381) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +9 -10
  3. package/dist/all/all.js +14 -27
  4. package/dist/all/all.js.map +1 -0
  5. package/dist/all/all.test.js +18 -24
  6. package/dist/all/all.test.js.map +1 -0
  7. package/dist/any/any.js +16 -29
  8. package/dist/any/any.js.map +1 -0
  9. package/dist/any/any.test.js +16 -21
  10. package/dist/any/any.test.js.map +1 -0
  11. package/dist/append/append.js +8 -18
  12. package/dist/append/append.js.map +1 -0
  13. package/dist/append/append.test.js +10 -15
  14. package/dist/append/append.test.js.map +1 -0
  15. package/dist/bottom/bottom.js +8 -16
  16. package/dist/bottom/bottom.js.map +1 -0
  17. package/dist/bottom/bottom.test.js +16 -21
  18. package/dist/bottom/bottom.test.js.map +1 -0
  19. package/dist/cases/cases.js +11 -24
  20. package/dist/cases/cases.js.map +1 -0
  21. package/dist/cases/cases.test.js +8 -13
  22. package/dist/cases/cases.test.js.map +1 -0
  23. package/dist/clone/clone.js +20 -33
  24. package/dist/clone/clone.js.map +1 -0
  25. package/dist/clone/clone.test.js +16 -21
  26. package/dist/clone/clone.test.js.map +1 -0
  27. package/dist/compact/compact.js +21 -35
  28. package/dist/compact/compact.js.map +1 -0
  29. package/dist/compact/compact.test.js +17 -21
  30. package/dist/compact/compact.test.js.map +1 -0
  31. package/dist/contains/contains.js +6 -13
  32. package/dist/contains/contains.js.map +1 -0
  33. package/dist/contains/contains.test.js +9 -14
  34. package/dist/contains/contains.test.js.map +1 -0
  35. package/dist/converge/converge.js +11 -22
  36. package/dist/converge/converge.js.map +1 -0
  37. package/dist/converge/converge.test.js +18 -24
  38. package/dist/converge/converge.test.js.map +1 -0
  39. package/dist/count/count.js +22 -40
  40. package/dist/count/count.js.map +1 -0
  41. package/dist/count/count.test.js +26 -34
  42. package/dist/count/count.test.js.map +1 -0
  43. package/dist/curry/curry.js +5 -15
  44. package/dist/curry/curry.js.map +1 -0
  45. package/dist/curry/curry.test.js +9 -48
  46. package/dist/curry/curry.test.js.map +1 -0
  47. package/dist/debounce/debounce.js +2 -8
  48. package/dist/debounce/debounce.js.map +1 -0
  49. package/dist/debounce/debounce.test.js +9 -14
  50. package/dist/debounce/debounce.test.js.map +1 -0
  51. package/dist/dec/dec.js +5 -13
  52. package/dist/dec/dec.js.map +1 -0
  53. package/dist/dec/dec.test.js +6 -11
  54. package/dist/dec/dec.test.js.map +1 -0
  55. package/dist/deep-equal/deep-equal.bench.js +28 -37
  56. package/dist/deep-equal/deep-equal.bench.js.map +1 -0
  57. package/dist/deep-equal/deep-equal.js +5 -83
  58. package/dist/deep-equal/deep-equal.js.map +1 -0
  59. package/dist/deep-equal/deep-equal.own.js +117 -0
  60. package/dist/deep-equal/deep-equal.own.js.map +1 -0
  61. package/dist/deep-equal/deep-equal.test.js +34 -32
  62. package/dist/deep-equal/deep-equal.test.js.map +1 -0
  63. package/dist/distinct/distinct.bench.js +13 -19
  64. package/dist/distinct/distinct.bench.js.map +1 -0
  65. package/dist/distinct/distinct.js +13 -24
  66. package/dist/distinct/distinct.js.map +1 -0
  67. package/dist/distinct/distinct.test.js +20 -82
  68. package/dist/distinct/distinct.test.js.map +1 -0
  69. package/dist/drop-last/drop-last.js +9 -17
  70. package/dist/drop-last/drop-last.js.map +1 -0
  71. package/dist/drop-last/drop-last.test.js +11 -16
  72. package/dist/drop-last/drop-last.test.js.map +1 -0
  73. package/dist/elapsed-time/elapsed-time.js +3 -11
  74. package/dist/elapsed-time/elapsed-time.js.map +1 -0
  75. package/dist/elapsed-time/elapsed-time.test.js +6 -11
  76. package/dist/elapsed-time/elapsed-time.test.js.map +1 -0
  77. package/dist/ends-with/ends-with.js +7 -14
  78. package/dist/ends-with/ends-with.js.map +1 -0
  79. package/dist/ends-with/ends-with.test.js +10 -15
  80. package/dist/ends-with/ends-with.test.js.map +1 -0
  81. package/dist/escape/escape.js +5 -12
  82. package/dist/escape/escape.js.map +1 -0
  83. package/dist/escape-html/escape-html.js +3 -11
  84. package/dist/escape-html/escape-html.js.map +1 -0
  85. package/dist/escape-html/escape-html.test.js +6 -11
  86. package/dist/escape-html/escape-html.test.js.map +1 -0
  87. package/dist/escape-reg-exp/escape-reg-exp.js +4 -11
  88. package/dist/escape-reg-exp/escape-reg-exp.js.map +1 -0
  89. package/dist/escape-reg-exp/escape-reg-exp.test.js +7 -12
  90. package/dist/escape-reg-exp/escape-reg-exp.test.js.map +1 -0
  91. package/dist/filter/filter.js +15 -28
  92. package/dist/filter/filter.js.map +1 -0
  93. package/dist/filter/filter.test.js +14 -21
  94. package/dist/filter/filter.test.js.map +1 -0
  95. package/dist/find/find.js +18 -32
  96. package/dist/find/find.js.map +1 -0
  97. package/dist/find/find.test.js +23 -19
  98. package/dist/find/find.test.js.map +1 -0
  99. package/dist/find-index/find-index.js +13 -26
  100. package/dist/find-index/find-index.js.map +1 -0
  101. package/dist/find-index/find-index.test.js +12 -17
  102. package/dist/find-index/find-index.test.js.map +1 -0
  103. package/dist/first/first.js +4 -12
  104. package/dist/first/first.js.map +1 -0
  105. package/dist/first/first.test.js +11 -16
  106. package/dist/first/first.test.js.map +1 -0
  107. package/dist/flatten/flatten.js +23 -36
  108. package/dist/flatten/flatten.js.map +1 -0
  109. package/dist/flatten/flatten.test.js +11 -16
  110. package/dist/flatten/flatten.test.js.map +1 -0
  111. package/dist/for-each/for-each.js +10 -21
  112. package/dist/for-each/for-each.js.map +1 -0
  113. package/dist/for-each/for-each.test.js +8 -14
  114. package/dist/for-each/for-each.test.js.map +1 -0
  115. package/dist/group-by/group-by.js +8 -15
  116. package/dist/group-by/group-by.js.map +1 -0
  117. package/dist/group-by/group-by.test.js +7 -12
  118. package/dist/group-by/group-by.test.js.map +1 -0
  119. package/dist/gt/gt.js +3 -10
  120. package/dist/gt/gt.js.map +1 -0
  121. package/dist/gt/gt.test.js +9 -14
  122. package/dist/gt/gt.test.js.map +1 -0
  123. package/dist/has-key/has-key.js +6 -14
  124. package/dist/has-key/has-key.js.map +1 -0
  125. package/dist/has-key/has-key.test.js +8 -13
  126. package/dist/has-key/has-key.test.js.map +1 -0
  127. package/dist/hist/hist.js +14 -21
  128. package/dist/hist/hist.js.map +1 -0
  129. package/dist/hist/hist.test.js +8 -13
  130. package/dist/hist/hist.test.js.map +1 -0
  131. package/dist/i/i.js +4 -12
  132. package/dist/i/i.js.map +1 -0
  133. package/dist/i/i.test.js +10 -15
  134. package/dist/i/i.test.js.map +1 -0
  135. package/dist/inc/inc.js +4 -12
  136. package/dist/inc/inc.js.map +1 -0
  137. package/dist/inc/inc.test.js +6 -11
  138. package/dist/inc/inc.test.js.map +1 -0
  139. package/dist/index-by/index-by.js +8 -15
  140. package/dist/index-by/index-by.js.map +1 -0
  141. package/dist/index-by/index-by.test.js +7 -12
  142. package/dist/index-by/index-by.test.js.map +1 -0
  143. package/dist/index.js +98 -1023
  144. package/dist/index.js.map +1 -0
  145. package/dist/index.test.js +6 -9
  146. package/dist/index.test.js.map +1 -0
  147. package/dist/intersect/intersect.js +11 -22
  148. package/dist/intersect/intersect.js.map +1 -0
  149. package/dist/intersect/intersect.test.js +40 -106
  150. package/dist/intersect/intersect.test.js.map +1 -0
  151. package/dist/is/is.js +18 -36
  152. package/dist/is/is.js.map +1 -0
  153. package/dist/is/is.test.js +26 -31
  154. package/dist/is/is.test.js.map +1 -0
  155. package/dist/is-between/is-between.js +4 -12
  156. package/dist/is-between/is-between.js.map +1 -0
  157. package/dist/is-between/is-between.test.js +10 -15
  158. package/dist/is-between/is-between.test.js.map +1 -0
  159. package/dist/is-empty/is-empty.js +16 -28
  160. package/dist/is-empty/is-empty.js.map +1 -0
  161. package/dist/is-empty/is-empty.test.js +23 -28
  162. package/dist/is-empty/is-empty.test.js.map +1 -0
  163. package/dist/is-equal/is-equal.js +3 -10
  164. package/dist/is-equal/is-equal.js.map +1 -0
  165. package/dist/is-equal/is-equal.test.js +12 -17
  166. package/dist/is-equal/is-equal.test.js.map +1 -0
  167. package/dist/is-match/is-match.js +13 -26
  168. package/dist/is-match/is-match.js.map +1 -0
  169. package/dist/is-match/is-match.test.js +26 -24
  170. package/dist/is-match/is-match.test.js.map +1 -0
  171. package/dist/is-uri/is-uri.js +6 -17
  172. package/dist/is-uri/is-uri.js.map +1 -0
  173. package/dist/is-uri/is-uri.test.js +15 -85
  174. package/dist/is-uri/is-uri.test.js.map +1 -0
  175. package/dist/join/join.js +11 -22
  176. package/dist/join/join.js.map +1 -0
  177. package/dist/join/join.test.js +42 -108
  178. package/dist/join/join.test.js.map +1 -0
  179. package/dist/keys/keys.js +7 -17
  180. package/dist/keys/keys.js.map +1 -0
  181. package/dist/keys/keys.test.js +9 -14
  182. package/dist/keys/keys.test.js.map +1 -0
  183. package/dist/last/last.js +6 -12
  184. package/dist/last/last.js.map +1 -0
  185. package/dist/last/last.test.js +10 -15
  186. package/dist/last/last.test.js.map +1 -0
  187. package/dist/lt/lt.js +7 -13
  188. package/dist/lt/lt.js.map +1 -0
  189. package/dist/lt/lt.test.js +8 -13
  190. package/dist/lt/lt.test.js.map +1 -0
  191. package/dist/map/map.js +13 -24
  192. package/dist/map/map.js.map +1 -0
  193. package/dist/map/map.test.js +13 -17
  194. package/dist/map/map.test.js.map +1 -0
  195. package/dist/map-matrix/map-matrix.js +14 -25
  196. package/dist/map-matrix/map-matrix.js.map +1 -0
  197. package/dist/map-matrix/map-matrix.test.js +9 -13
  198. package/dist/map-matrix/map-matrix.test.js.map +1 -0
  199. package/dist/max/max.js +26 -40
  200. package/dist/max/max.js.map +1 -0
  201. package/dist/max/max.test.js +14 -20
  202. package/dist/max/max.test.js.map +1 -0
  203. package/dist/merge/merge.js +18 -34
  204. package/dist/merge/merge.js.map +1 -0
  205. package/dist/merge/merge.test.js +12 -17
  206. package/dist/merge/merge.test.js.map +1 -0
  207. package/dist/min/min.js +26 -40
  208. package/dist/min/min.js.map +1 -0
  209. package/dist/min/min.test.js +13 -19
  210. package/dist/min/min.test.js.map +1 -0
  211. package/dist/move/move.js +15 -25
  212. package/dist/move/move.js.map +1 -0
  213. package/dist/move/move.test.js +10 -15
  214. package/dist/move/move.test.js.map +1 -0
  215. package/dist/mutate/mutate.js +31 -51
  216. package/dist/mutate/mutate.js.map +1 -0
  217. package/dist/mutate/mutate.test.js +19 -23
  218. package/dist/mutate/mutate.test.js.map +1 -0
  219. package/dist/page/page.js +6 -14
  220. package/dist/page/page.js.map +1 -0
  221. package/dist/page/page.test.js +9 -14
  222. package/dist/page/page.test.js.map +1 -0
  223. package/dist/partition/partition.js +17 -31
  224. package/dist/partition/partition.js.map +1 -0
  225. package/dist/partition/partition.test.js +14 -20
  226. package/dist/partition/partition.test.js.map +1 -0
  227. package/dist/pick/pick.js +12 -20
  228. package/dist/pick/pick.js.map +1 -0
  229. package/dist/pick/pick.test.js +8 -13
  230. package/dist/pick/pick.test.js.map +1 -0
  231. package/dist/pipe/pipe.js +4 -12
  232. package/dist/pipe/pipe.js.map +1 -0
  233. package/dist/pipe/pipe.test.js +9 -13
  234. package/dist/pipe/pipe.test.js.map +1 -0
  235. package/dist/pipe-p/pipe-p.js +4 -10
  236. package/dist/pipe-p/pipe-p.js.map +1 -0
  237. package/dist/pipe-p/pipe-p.test.js +10 -15
  238. package/dist/pipe-p/pipe-p.test.js.map +1 -0
  239. package/dist/pluck/pluck.js +18 -26
  240. package/dist/pluck/pluck.js.map +1 -0
  241. package/dist/pluck/pluck.test.js +10 -15
  242. package/dist/pluck/pluck.test.js.map +1 -0
  243. package/dist/prepend/prepend.js +11 -21
  244. package/dist/prepend/prepend.js.map +1 -0
  245. package/dist/prepend/prepend.test.js +10 -15
  246. package/dist/prepend/prepend.test.js.map +1 -0
  247. package/dist/proto-chain/proto-chain.js +9 -17
  248. package/dist/proto-chain/proto-chain.js.map +1 -0
  249. package/dist/proto-chain/proto-chain.test.js +8 -13
  250. package/dist/proto-chain/proto-chain.test.js.map +1 -0
  251. package/dist/push/push.js +7 -15
  252. package/dist/push/push.js.map +1 -0
  253. package/dist/push/push.test.js +9 -14
  254. package/dist/push/push.test.js.map +1 -0
  255. package/dist/raise/raise.js +2 -8
  256. package/dist/raise/raise.js.map +1 -0
  257. package/dist/raise/raise.test.js +6 -11
  258. package/dist/raise/raise.test.js.map +1 -0
  259. package/dist/random/random.js +3 -11
  260. package/dist/random/random.js.map +1 -0
  261. package/dist/random/random.test.js +16 -17
  262. package/dist/random/random.test.js.map +1 -0
  263. package/dist/read/read.js +23 -40
  264. package/dist/read/read.js.map +1 -0
  265. package/dist/read/read.test.js +63 -179
  266. package/dist/read/read.test.js.map +1 -0
  267. package/dist/reduce/reduce.js +17 -28
  268. package/dist/reduce/reduce.js.map +1 -0
  269. package/dist/reduce/reduce.test.js +14 -19
  270. package/dist/reduce/reduce.test.js.map +1 -0
  271. package/dist/remove/remove.js +27 -42
  272. package/dist/remove/remove.js.map +1 -0
  273. package/dist/remove/remove.test.js +14 -21
  274. package/dist/remove/remove.test.js.map +1 -0
  275. package/dist/rename/rename.js +26 -40
  276. package/dist/rename/rename.js.map +1 -0
  277. package/dist/rename/rename.test.js +42 -103
  278. package/dist/rename/rename.test.js.map +1 -0
  279. package/dist/rename-file/rename-file.js +14 -28
  280. package/dist/rename-file/rename-file.js.map +1 -0
  281. package/dist/rename-file/rename-file.test.js +11 -16
  282. package/dist/rename-file/rename-file.test.js.map +1 -0
  283. package/dist/repeat/repeat.js +10 -21
  284. package/dist/repeat/repeat.js.map +1 -0
  285. package/dist/repeat/repeat.test.js +10 -14
  286. package/dist/repeat/repeat.test.js.map +1 -0
  287. package/dist/replace/replace.js +17 -27
  288. package/dist/replace/replace.js.map +1 -0
  289. package/dist/replace/replace.test.js +17 -22
  290. package/dist/replace/replace.test.js.map +1 -0
  291. package/dist/same/same.js +4 -12
  292. package/dist/same/same.js.map +1 -0
  293. package/dist/same/same.test.js +6 -11
  294. package/dist/same/same.test.js.map +1 -0
  295. package/dist/sequence/sequence.js +10 -21
  296. package/dist/sequence/sequence.js.map +1 -0
  297. package/dist/sequence/sequence.test.js +17 -22
  298. package/dist/sequence/sequence.test.js.map +1 -0
  299. package/dist/sort/sort-with.js +15 -27
  300. package/dist/sort/sort-with.js.map +1 -0
  301. package/dist/sort/sort.js +19 -31
  302. package/dist/sort/sort.js.map +1 -0
  303. package/dist/sort/sort.test.js +298 -368
  304. package/dist/sort/sort.test.js.map +1 -0
  305. package/dist/split/split.js +15 -25
  306. package/dist/split/split.js.map +1 -0
  307. package/dist/split/split.test.js +14 -59
  308. package/dist/split/split.test.js.map +1 -0
  309. package/dist/split-in-groups-of/split-in-groups-of.js +10 -20
  310. package/dist/split-in-groups-of/split-in-groups-of.js.map +1 -0
  311. package/dist/split-in-groups-of/split-in-groups-of.test.js +17 -77
  312. package/dist/split-in-groups-of/split-in-groups-of.test.js.map +1 -0
  313. package/dist/spy/spy.js +5 -13
  314. package/dist/spy/spy.js.map +1 -0
  315. package/dist/spy/spy.test.js +25 -70
  316. package/dist/spy/spy.test.js.map +1 -0
  317. package/dist/starts-with/starts-with.js +5 -12
  318. package/dist/starts-with/starts-with.js.map +1 -0
  319. package/dist/starts-with/starts-with.test.js +11 -16
  320. package/dist/starts-with/starts-with.test.js.map +1 -0
  321. package/dist/throttle/throttle.js +2 -8
  322. package/dist/throttle/throttle.js.map +1 -0
  323. package/dist/throttle/throttle.test.js +11 -16
  324. package/dist/throttle/throttle.test.js.map +1 -0
  325. package/dist/to-lower/to-lower.js +4 -12
  326. package/dist/to-lower/to-lower.js.map +1 -0
  327. package/dist/to-lower/to-lower.test.js +7 -12
  328. package/dist/to-lower/to-lower.test.js.map +1 -0
  329. package/dist/to-upper/to-upper.js +4 -12
  330. package/dist/to-upper/to-upper.js.map +1 -0
  331. package/dist/to-upper/to-upper.test.js +7 -12
  332. package/dist/to-upper/to-upper.test.js.map +1 -0
  333. package/dist/toggle/toggle.js +12 -22
  334. package/dist/toggle/toggle.js.map +1 -0
  335. package/dist/toggle/toggle.test.js +8 -13
  336. package/dist/toggle/toggle.test.js.map +1 -0
  337. package/dist/top/top.js +10 -16
  338. package/dist/top/top.js.map +1 -0
  339. package/dist/top/top.test.js +16 -21
  340. package/dist/top/top.test.js.map +1 -0
  341. package/dist/trim/trim.js +9 -15
  342. package/dist/trim/trim.js.map +1 -0
  343. package/dist/trim/trim.test.js +8 -13
  344. package/dist/trim/trim.test.js.map +1 -0
  345. package/dist/try-catch/try-catch.js +6 -12
  346. package/dist/try-catch/try-catch.js.map +1 -0
  347. package/dist/try-catch/try-catch.test.js +10 -16
  348. package/dist/try-catch/try-catch.test.js.map +1 -0
  349. package/dist/type/type.js +5 -11
  350. package/dist/type/type.js.map +1 -0
  351. package/dist/type/type.test.js +17 -22
  352. package/dist/type/type.test.js.map +1 -0
  353. package/dist/unite/unite.js +5 -12
  354. package/dist/unite/unite.js.map +1 -0
  355. package/dist/unite/unite.test.js +7 -37
  356. package/dist/unite/unite.test.js.map +1 -0
  357. package/dist/update/update.js +27 -45
  358. package/dist/update/update.js.map +1 -0
  359. package/dist/update/update.test.js +17 -21
  360. package/dist/update/update.test.js.map +1 -0
  361. package/dist/upsert/upsert.js +11 -20
  362. package/dist/upsert/upsert.js.map +1 -0
  363. package/dist/upsert/upsert.test.js +12 -17
  364. package/dist/upsert/upsert.test.js.map +1 -0
  365. package/dist/values/values.js +8 -19
  366. package/dist/values/values.js.map +1 -0
  367. package/dist/values/values.test.js +9 -14
  368. package/dist/values/values.test.js.map +1 -0
  369. package/dist/when/when.js +16 -27
  370. package/dist/when/when.js.map +1 -0
  371. package/dist/when/when.test.js +18 -24
  372. package/dist/when/when.test.js.map +1 -0
  373. package/dist/write/write.js +8 -16
  374. package/dist/write/write.js.map +1 -0
  375. package/dist/write/write.test.js +9 -14
  376. package/dist/write/write.test.js.map +1 -0
  377. package/dist/zip-to-object/zip-to-object.js +5 -11
  378. package/dist/zip-to-object/zip-to-object.js.map +1 -0
  379. package/dist/zip-to-object/zip-to-object.test.js +8 -13
  380. package/dist/zip-to-object/zip-to-object.test.js.map +1 -0
  381. package/package.json +33 -32
@@ -1,111 +1,45 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
6
-
7
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
8
-
9
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
-
11
- var _riteway = require("riteway");
12
-
13
- var _join = require("./join");
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
14
2
 
15
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; }
16
4
 
17
- 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) { (0, _defineProperty2.default)(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; }
18
-
19
- (0, _riteway.describe)("join", /*#__PURE__*/function () {
20
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(assert) {
21
- return _regenerator.default.wrap(function _callee$(_context) {
22
- while (1) {
23
- switch (_context.prev = _context.next) {
24
- case 0:
25
- assert({
26
- given: "empty first array",
27
- should: "return contents of second array",
28
- actual: (0, _join.join)([], [1, 2, 3]),
29
- expected: [1, 2, 3]
30
- });
31
- assert({
32
- given: "empty second array",
33
- should: "return contents of first array",
34
- actual: (0, _join.join)([1, 2, 3], []),
35
- expected: [1, 2, 3]
36
- });
37
- assert({
38
- given: "two non empty arrays with common items",
39
- should: "return distinct items of both arrays",
40
- actual: (0, _join.join)([1, 1, 2, 3, 3], [3, 3, 4, 4, 5]),
41
- expected: [1, 2, 3, 4, 5]
42
- });
43
- assert({
44
- given: "two non empty arrays without common items",
45
- should: "return array with items from both arrays",
46
- actual: (0, _join.join)([1, 2])([3, 4, 5]),
47
- expected: [1, 2, 3, 4, 5]
48
- });
49
-
50
- case 4:
51
- case "end":
52
- return _context.stop();
53
- }
54
- }
55
- }, _callee);
56
- }));
57
-
58
- return function (_x) {
59
- return _ref.apply(this, arguments);
60
- };
61
- }());
62
- (0, _riteway.describe)("joinBy", /*#__PURE__*/function () {
63
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(assert) {
64
- return _regenerator.default.wrap(function _callee2$(_context2) {
65
- while (1) {
66
- switch (_context2.prev = _context2.next) {
67
- case 0:
68
- assert({
69
- given: "two non empty object arrays with common items",
70
- should: "return array with items from both arrays, with merged values for common ones",
71
- actual: (0, _join.joinBy)(function (a, b) {
72
- return a.id === b.id;
73
- }, function (a, b) {
74
- return _objectSpread(_objectSpread({}, a), b);
75
- }, [{
76
- id: 1,
77
- overwrite: 1
78
- }, {
79
- id: 2
80
- }, {
81
- id: 2
82
- }], [{
83
- id: 1,
84
- overwrite: 2,
85
- foo: "bar"
86
- }, {
87
- id: 3
88
- }]),
89
- expected: [{
90
- id: 1,
91
- overwrite: 2,
92
- foo: "bar"
93
- }, {
94
- id: 2
95
- }, {
96
- id: 3
97
- }]
98
- });
99
-
100
- case 1:
101
- case "end":
102
- return _context2.stop();
103
- }
104
- }
105
- }, _callee2);
106
- }));
107
-
108
- return function (_x2) {
109
- return _ref2.apply(this, arguments);
110
- };
111
- }());
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
+
7
+ import test from "tape";
8
+ import { join, joinBy } from "./join.js";
9
+ test("join", function (t) {
10
+ t.deepEqual(join([], [1, 2, 3]), [1, 2, 3], "given [empty first array] should [return contents of second array]");
11
+ t.deepEqual(join([1, 2, 3], []), [1, 2, 3], "given [empty second array] should [return contents of first array]");
12
+ t.deepEqual(join([1, 1, 2, 3, 3], [3, 3, 4, 4, 5]), [1, 2, 3, 4, 5], "given [two non empty arrays with common items] should [return distinct items of both arrays]");
13
+ t.deepEqual(join([1, 2])([3, 4, 5]), [1, 2, 3, 4, 5], "given [two non empty arrays without common items] should [return array with items from both arrays]");
14
+ t.end();
15
+ });
16
+ test("joinBy", function (t) {
17
+ t.deepEqual(joinBy(function (a, b) {
18
+ return a.id === b.id;
19
+ }, function (a, b) {
20
+ return _objectSpread(_objectSpread({}, a), b);
21
+ }, [{
22
+ id: 1,
23
+ overwrite: 1
24
+ }, {
25
+ id: 2
26
+ }, {
27
+ id: 2
28
+ }], [{
29
+ id: 1,
30
+ overwrite: 2,
31
+ foo: "bar"
32
+ }, {
33
+ id: 3
34
+ }]), [{
35
+ id: 1,
36
+ overwrite: 2,
37
+ foo: "bar"
38
+ }, {
39
+ id: 2
40
+ }, {
41
+ id: 3
42
+ }], "given [two non empty object arrays with common items] should [return array with items from both arrays, with merged values for common ones]");
43
+ t.end();
44
+ });
45
+ //# sourceMappingURL=join.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/join/join.test.js"],"names":["test","join","joinBy","t","deepEqual","end","a","b","id","overwrite","foo"],"mappings":";;;;;;AAAA,OAAOA,IAAP,MAAiB,MAAjB;AAEA,SAASC,IAAT,EAAeC,MAAf,QAA6B,WAA7B;AAEAF,IAAI,CAAC,MAAD,EAAS,UAAAG,CAAC,EAAI;AAChBA,EAAAA,CAAC,CAACC,SAAF,CACEH,IAAI,CAAC,EAAD,EAAK,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAAL,CADN,EAEE,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAFF,EAGE,oEAHF;AAMAE,EAAAA,CAAC,CAACC,SAAF,CACEH,IAAI,CAAC,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAAD,EAAY,EAAZ,CADN,EAEE,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAFF,EAGE,oEAHF;AAMAE,EAAAA,CAAC,CAACC,SAAF,CACEH,IAAI,CAAC,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,EAAa,CAAb,CAAD,EAAkB,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,EAAa,CAAb,CAAlB,CADN,EAEE,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,EAAa,CAAb,CAFF,EAGE,8FAHF;AAMAE,EAAAA,CAAC,CAACC,SAAF,CACEH,IAAI,CAAC,CAAC,CAAD,EAAI,CAAJ,CAAD,CAAJ,CAAa,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAAb,CADF,EAEE,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,EAAa,CAAb,CAFF,EAGE,qGAHF;AAMAE,EAAAA,CAAC,CAACE,GAAF;AACD,CA1BG,CAAJ;AA4BAL,IAAI,CAAC,QAAD,EAAW,UAAAG,CAAC,EAAI;AAClBA,EAAAA,CAAC,CAACC,SAAF,CACEF,MAAM,CACJ,UAACI,CAAD,EAAIC,CAAJ;AAAA,WAAUD,CAAC,CAACE,EAAF,KAASD,CAAC,CAACC,EAArB;AAAA,GADI,EAEJ,UAACF,CAAD,EAAIC,CAAJ;AAAA,2CAAgBD,CAAhB,GAAsBC,CAAtB;AAAA,GAFI,EAGJ,CAAC;AAAEC,IAAAA,EAAE,EAAE,CAAN;AAASC,IAAAA,SAAS,EAAE;AAApB,GAAD,EAA0B;AAAED,IAAAA,EAAE,EAAE;AAAN,GAA1B,EAAqC;AAAEA,IAAAA,EAAE,EAAE;AAAN,GAArC,CAHI,EAIJ,CAAC;AAAEA,IAAAA,EAAE,EAAE,CAAN;AAASC,IAAAA,SAAS,EAAE,CAApB;AAAuBC,IAAAA,GAAG,EAAE;AAA5B,GAAD,EAAsC;AAAEF,IAAAA,EAAE,EAAE;AAAN,GAAtC,CAJI,CADR,EAOE,CAAC;AAAEA,IAAAA,EAAE,EAAE,CAAN;AAASC,IAAAA,SAAS,EAAE,CAApB;AAAuBC,IAAAA,GAAG,EAAE;AAA5B,GAAD,EAAsC;AAAEF,IAAAA,EAAE,EAAE;AAAN,GAAtC,EAAiD;AAAEA,IAAAA,EAAE,EAAE;AAAN,GAAjD,CAPF,EAQE,6IARF;AAWAL,EAAAA,CAAC,CAACE,GAAF;AACD,CAbG,CAAJ","sourcesContent":["import test from \"tape\"\n\nimport { join, joinBy } from \"./join.js\"\n\ntest(\"join\", t => {\n t.deepEqual(\n join([], [1, 2, 3]),\n [1, 2, 3],\n \"given [empty first array] should [return contents of second array]\"\n )\n\n t.deepEqual(\n join([1, 2, 3], []),\n [1, 2, 3],\n \"given [empty second array] should [return contents of first array]\"\n )\n\n t.deepEqual(\n join([1, 1, 2, 3, 3], [3, 3, 4, 4, 5]),\n [1, 2, 3, 4, 5],\n \"given [two non empty arrays with common items] should [return distinct items of both arrays]\"\n )\n\n t.deepEqual(\n join([1, 2])([3, 4, 5]),\n [1, 2, 3, 4, 5],\n \"given [two non empty arrays without common items] should [return array with items from both arrays]\"\n )\n\n t.end()\n})\n\ntest(\"joinBy\", t => {\n t.deepEqual(\n joinBy(\n (a, b) => a.id === b.id,\n (a, b) => ({ ...a, ...b }),\n [{ id: 1, overwrite: 1 }, { id: 2 }, { id: 2 }],\n [{ id: 1, overwrite: 2, foo: \"bar\" }, { id: 3 }]\n ),\n [{ id: 1, overwrite: 2, foo: \"bar\" }, { id: 2 }, { id: 3 }],\n \"given [two non empty object arrays with common items] should [return array with items from both arrays, with merged values for common ones]\"\n )\n\n t.end()\n})\n"],"file":"join.test.js"}
package/dist/keys/keys.js CHANGED
@@ -1,24 +1,15 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.keys = void 0;
9
-
10
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
1
+ import _typeof from "@babel/runtime/helpers/typeof";
11
2
 
12
3
  /**
13
4
  * Get list with names of all own properties
14
5
  *
15
- * @param {Array|Object} source Array or Object to extract keys from
6
+ * @param {Array|Object} input Array or Object to extract keys from
16
7
  *
17
8
  * @returns {string[]} List of property names
18
9
  *
19
10
  * @name keys
20
11
  * @tag Array,Object
21
- * @signature (source: Array|Object): string[]
12
+ * @signature (input: Array|Object): string[]
22
13
  *
23
14
  * @example
24
15
  * keys(["lorem", "ipsum"])
@@ -30,14 +21,14 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
30
21
  * keys("foo"), keys(12), keys(null), etc
31
22
  * // => []
32
23
  */
33
- var keys = function keys(source) {
34
- var type = Array.isArray(source) ? "array" : source !== null && (0, _typeof2.default)(source) === "object" ? "object" : "other";
24
+ export var keys = function keys(input) {
25
+ var type = Array.isArray(input) ? "array" : input !== null && _typeof(input) === "object" ? "object" : "other";
35
26
 
36
27
  switch (type) {
37
28
  case "object":
38
29
  case "array":
39
30
  {
40
- var entries = Object.entries(source);
31
+ var entries = Object.entries(input);
41
32
  var result = [];
42
33
 
43
34
  for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
@@ -52,5 +43,4 @@ var keys = function keys(source) {
52
43
  return [];
53
44
  }
54
45
  };
55
-
56
- exports.keys = keys;
46
+ //# sourceMappingURL=keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/keys/keys.js"],"names":["keys","input","type","Array","isArray","entries","Object","result","entry","push"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMA,IAAI,GAAG,SAAPA,IAAO,CAAAC,KAAK,EAAI;AAC3B,MAAMC,IAAI,GAAGC,KAAK,CAACC,OAAN,CAAcH,KAAd,IACT,OADS,GAETA,KAAK,KAAK,IAAV,IAAkB,QAAOA,KAAP,MAAiB,QAAnC,GACA,QADA,GAEA,OAJJ;;AAMA,UAAQC,IAAR;AACE,SAAK,QAAL;AACA,SAAK,OAAL;AAAc;AACZ,YAAMG,OAAO,GAAGC,MAAM,CAACD,OAAP,CAAeJ,KAAf,CAAhB;AACA,YAAMM,MAAM,GAAG,EAAf;;AAEA,oCAAoBF,OAApB,8BAA6B;AAAxB,cAAMG,KAAK,eAAX;AACHD,UAAAA,MAAM,CAACE,IAAP,CAAYD,KAAK,CAAC,CAAD,CAAjB;AACD;;AAED,eAAOD,MAAP;AACD;;AACD;AACE,aAAO,EAAP;AAbJ;AAeD,CAtBM","sourcesContent":["/**\n * Get list with names of all own properties\n *\n * @param {Array|Object} input Array or Object to extract keys from\n *\n * @returns {string[]} List of property names\n *\n * @name keys\n * @tag Array,Object\n * @signature (input: Array|Object): string[]\n *\n * @example\n * keys([\"lorem\", \"ipsum\"])\n * // => [\"0\", \"1\"]\n *\n * keys({ foo: \"bar\", lorem: \"ipsum\"})\n * // => [\"foo\", \"lorem\"]\n *\n * keys(\"foo\"), keys(12), keys(null), etc\n * // => []\n */\nexport const keys = input => {\n const type = Array.isArray(input)\n ? \"array\"\n : input !== null && typeof input === \"object\"\n ? \"object\"\n : \"other\"\n\n switch (type) {\n case \"object\":\n case \"array\": {\n const entries = Object.entries(input)\n const result = []\n\n for (const entry of entries) {\n result.push(entry[0])\n }\n\n return result\n }\n default:\n return []\n }\n}\n"],"file":"keys.js"}
@@ -1,18 +1,13 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _tape = _interopRequireDefault(require("tape"));
6
-
7
- var _keys = require("./keys");
8
-
9
- (0, _tape.default)("keys", function (t) {
10
- t.deepEquals((0, _keys.keys)(["test", 1, 2]), ["0", "1", "2"], "When passing an array, should return an array of string with the index of each element");
11
- t.deepEquals((0, _keys.keys)({
1
+ import test from "tape";
2
+ import { keys } from "./keys.js";
3
+ test("keys", function (t) {
4
+ t.deepEquals(keys(["test", 1, 2]), ["0", "1", "2"], "When passing an array, should return an array of string with the index of each element");
5
+ t.deepEquals(keys({
12
6
  foo: "bar",
13
7
  lorem: "ipsum"
14
8
  }), ["foo", "lorem"], "When passing an object, should return an array of strings with the key values");
15
- t.deepEquals((0, _keys.keys)("lorem"), [], "When passing a string, should return an empty array");
16
- t.deepEquals((0, _keys.keys)(12), [], "when passing a number, should return an empty array");
9
+ t.deepEquals(keys("lorem"), [], "When passing a string, should return an empty array");
10
+ t.deepEquals(keys(12), [], "when passing a number, should return an empty array");
17
11
  t.end();
18
- });
12
+ });
13
+ //# sourceMappingURL=keys.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/keys/keys.test.js"],"names":["test","keys","t","deepEquals","foo","lorem","end"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,MAAjB;AAEA,SAASC,IAAT,QAAqB,WAArB;AAEAD,IAAI,CAAC,MAAD,EAAS,UAAAE,CAAC,EAAI;AAChBA,EAAAA,CAAC,CAACC,UAAF,CACEF,IAAI,CAAC,CAAC,MAAD,EAAS,CAAT,EAAY,CAAZ,CAAD,CADN,EAEE,CAAC,GAAD,EAAM,GAAN,EAAW,GAAX,CAFF,EAGE,wFAHF;AAMAC,EAAAA,CAAC,CAACC,UAAF,CACEF,IAAI,CAAC;AAAEG,IAAAA,GAAG,EAAE,KAAP;AAAcC,IAAAA,KAAK,EAAE;AAArB,GAAD,CADN,EAEE,CAAC,KAAD,EAAQ,OAAR,CAFF,EAGE,+EAHF;AAMAH,EAAAA,CAAC,CAACC,UAAF,CACEF,IAAI,CAAC,OAAD,CADN,EAEE,EAFF,EAGE,qDAHF;AAMAC,EAAAA,CAAC,CAACC,UAAF,CACEF,IAAI,CAAC,EAAD,CADN,EAEE,EAFF,EAGE,qDAHF;AAMAC,EAAAA,CAAC,CAACI,GAAF;AACD,CA1BG,CAAJ","sourcesContent":["import test from \"tape\"\n\nimport { keys } from \"./keys.js\"\n\ntest(\"keys\", t => {\n t.deepEquals(\n keys([\"test\", 1, 2]),\n [\"0\", \"1\", \"2\"],\n \"When passing an array, should return an array of string with the index of each element\"\n )\n\n t.deepEquals(\n keys({ foo: \"bar\", lorem: \"ipsum\" }),\n [\"foo\", \"lorem\"],\n \"When passing an object, should return an array of strings with the key values\"\n )\n\n t.deepEquals(\n keys(\"lorem\"),\n [],\n \"When passing a string, should return an empty array\"\n )\n\n t.deepEquals(\n keys(12),\n [],\n \"when passing a number, should return an empty array\"\n )\n\n t.end()\n})\n"],"file":"keys.test.js"}
package/dist/last/last.js CHANGED
@@ -1,20 +1,13 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.last = void 0;
7
-
8
1
  /**
9
2
  * Get right most element of array
10
3
  *
11
- * @param {Array} source The source
4
+ * @param {Array} input The source
12
5
  *
13
6
  * @returns {any}
14
7
  *
15
8
  * @name last
16
9
  * @tag Array
17
- * @signature (source: Array): mixed
10
+ * @signature (input: Array): mixed
18
11
  *
19
12
  * @example
20
13
  * last([1, 2, 3])
@@ -22,8 +15,9 @@ exports.last = void 0;
22
15
  * last([])
23
16
  * // => undefined
24
17
  */
25
- var last = function last(source) {
26
- return (Array.isArray(source) || typeof source === "string") && source.length !== 0 ? source[source.length - 1] : undefined;
18
+ var last = function last(input) {
19
+ return (Array.isArray(input) || typeof input === "string") && input.length !== 0 ? input[input.length - 1] : undefined;
27
20
  };
28
21
 
29
- exports.last = last;
22
+ export { last };
23
+ //# sourceMappingURL=last.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/last/last.js"],"names":["last","input","Array","isArray","length","undefined"],"mappings":"AAAA;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,SAChB,CAACC,KAAK,CAACC,OAAN,CAAcF,KAAd,KAAwB,OAAOA,KAAP,KAAiB,QAA1C,KAAuDA,KAAK,CAACG,MAAN,KAAiB,CAAxE,GACIH,KAAK,CAACA,KAAK,CAACG,MAAN,GAAe,CAAhB,CADT,GAEIC,SAHY;AAAA,CAAlB;;AAKA,SAASL,IAAT","sourcesContent":["/**\n * Get right most element of array\n *\n * @param {Array} input The source\n *\n * @returns {any}\n *\n * @name last\n * @tag Array\n * @signature (input: Array): mixed\n *\n * @example\n * last([1, 2, 3])\n * // => 3\n * last([])\n * // => undefined\n */\nconst last = input =>\n (Array.isArray(input) || typeof input === \"string\") && input.length !== 0\n ? input[input.length - 1]\n : undefined\n\nexport { last }\n"],"file":"last.js"}
@@ -1,16 +1,11 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _tape = _interopRequireDefault(require("tape"));
6
-
7
- var _last = require("./last");
8
-
9
- (0, _tape.default)("last", function (t) {
10
- t.equals((0, _last.last)([1, 2, 3]), 3, "Get last element from n array");
11
- t.equals((0, _last.last)([1]), 1, "Get last element of an 1 array");
12
- t.equals((0, _last.last)("xyz"), "z", "From string should return last char");
13
- t.equals((0, _last.last)([]), undefined, "Get last element of empty array");
14
- t.equals((0, _last.last)({}), undefined, "Get last element of empty object");
1
+ import test from "tape";
2
+ import { last } from "./last.js";
3
+ test("last", function (t) {
4
+ t.equals(last([1, 2, 3]), 3, "Get last element from n array");
5
+ t.equals(last([1]), 1, "Get last element of an 1 array");
6
+ t.equals(last("xyz"), "z", "From string should return last char");
7
+ t.equals(last([]), undefined, "Get last element of empty array");
8
+ t.equals(last({}), undefined, "Get last element of empty object");
15
9
  t.end();
16
- });
10
+ });
11
+ //# sourceMappingURL=last.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/last/last.test.js"],"names":["test","last","t","equals","undefined","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,CAAC,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAAD,CAAb,EAA0B,CAA1B,EAA6B,+BAA7B;AAEAC,EAAAA,CAAC,CAACC,MAAF,CAASF,IAAI,CAAC,CAAC,CAAD,CAAD,CAAb,EAAoB,CAApB,EAAuB,gCAAvB;AAEAC,EAAAA,CAAC,CAACC,MAAF,CAASF,IAAI,CAAC,KAAD,CAAb,EAAsB,GAAtB,EAA2B,qCAA3B;AAEAC,EAAAA,CAAC,CAACC,MAAF,CAASF,IAAI,CAAC,EAAD,CAAb,EAAmBG,SAAnB,EAA8B,iCAA9B;AAEAF,EAAAA,CAAC,CAACC,MAAF,CAASF,IAAI,CAAC,EAAD,CAAb,EAAmBG,SAAnB,EAA8B,kCAA9B;AAEAF,EAAAA,CAAC,CAACG,GAAF;AACD,CAZG,CAAJ","sourcesContent":["import test from \"tape\"\n\nimport { last } from \"./last.js\"\n\ntest(\"last\", t => {\n t.equals(last([1, 2, 3]), 3, \"Get last element from n array\")\n\n t.equals(last([1]), 1, \"Get last element of an 1 array\")\n\n t.equals(last(\"xyz\"), \"z\", \"From string should return last char\")\n\n t.equals(last([]), undefined, \"Get last element of empty array\")\n\n t.equals(last({}), undefined, \"Get last element of empty object\")\n\n t.end()\n})\n"],"file":"last.test.js"}
package/dist/lt/lt.js CHANGED
@@ -1,12 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.lt = void 0;
7
-
8
- var _curry = require("../curry/curry");
9
-
1
+ import { curry } from "../curry/curry.js";
10
2
  /**
11
3
  * Less compare.
12
4
  *
@@ -19,16 +11,18 @@ var _curry = require("../curry/curry");
19
11
  * @returns {boolean}
20
12
  *
21
13
  * @tag Core
22
- * @signarure (first: number) => (second: number): boolean
23
- * @signarure (first: number, second: number): boolean
14
+ * @signature (first: number) => (second: number): boolean
15
+ * @signature (first: number, second: number): boolean
24
16
  *
25
17
  * @example
26
18
  * lt(10)(4)
27
19
  * // => true
20
+ *
28
21
  * lt(10)(14)
29
22
  * // => false
30
23
  */
31
- var lt = (0, _curry.curry)(function (second, first) {
24
+
25
+ export var lt = curry(function (second, first) {
32
26
  return first < second;
33
27
  });
34
- exports.lt = lt;
28
+ //# sourceMappingURL=lt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lt/lt.js"],"names":["curry","lt","second","first"],"mappings":"AAAA,SAASA,KAAT,QAAsB,mBAAtB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMC,EAAE,GAAGD,KAAK,CAAC,UAACE,MAAD,EAASC,KAAT;AAAA,SAAmBA,KAAK,GAAGD,MAA3B;AAAA,CAAD,CAAhB","sourcesContent":["import { curry } from \"../curry/curry.js\"\n\n/**\n * Less compare.\n *\n * Since this will mostly be used in pipe, the first param in the curry chain\n * is the second operand.\n *\n * @param {number} second Second number\n * @param {number} first First number\n *\n * @returns {boolean}\n *\n * @tag Core\n * @signature (first: number) => (second: number): boolean\n * @signature (first: number, second: number): boolean\n *\n * @example\n * lt(10)(4)\n * // => true\n *\n * lt(10)(14)\n * // => false\n */\nexport const lt = curry((second, first) => first < second)\n"],"file":"lt.js"}
@@ -1,14 +1,9 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _tape = _interopRequireDefault(require("tape"));
6
-
7
- var _lt = require("./lt");
8
-
9
- (0, _tape.default)("lt", function (t) {
10
- t.equals((0, _lt.lt)(10)(14), false, "14 is not less than 10");
11
- t.equals((0, _lt.lt)(10)(10), false, "10 is not less than 10");
12
- t.equals((0, _lt.lt)(10)(4), true, "4 is less than 10");
1
+ import test from "tape";
2
+ import { lt } from "./lt.js";
3
+ test("lt", function (t) {
4
+ t.equals(lt(10)(14), false, "14 is not less than 10");
5
+ t.equals(lt(10)(10), false, "10 is not less than 10");
6
+ t.equals(lt(10)(4), true, "4 is less than 10");
13
7
  t.end();
14
- });
8
+ });
9
+ //# sourceMappingURL=lt.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lt/lt.test.js"],"names":["test","lt","t","equals","end"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,MAAjB;AAEA,SAASC,EAAT,QAAmB,SAAnB;AAEAD,IAAI,CAAC,IAAD,EAAO,UAAAE,CAAC,EAAI;AACdA,EAAAA,CAAC,CAACC,MAAF,CAASF,EAAE,CAAC,EAAD,CAAF,CAAO,EAAP,CAAT,EAAqB,KAArB,EAA4B,wBAA5B;AAEAC,EAAAA,CAAC,CAACC,MAAF,CAASF,EAAE,CAAC,EAAD,CAAF,CAAO,EAAP,CAAT,EAAqB,KAArB,EAA4B,wBAA5B;AAEAC,EAAAA,CAAC,CAACC,MAAF,CAASF,EAAE,CAAC,EAAD,CAAF,CAAO,CAAP,CAAT,EAAoB,IAApB,EAA0B,mBAA1B;AAEAC,EAAAA,CAAC,CAACE,GAAF;AACD,CARG,CAAJ","sourcesContent":["import test from \"tape\"\n\nimport { lt } from \"./lt.js\"\n\ntest(\"lt\", t => {\n t.equals(lt(10)(14), false, \"14 is not less than 10\")\n\n t.equals(lt(10)(10), false, \"10 is not less than 10\")\n\n t.equals(lt(10)(4), true, \"4 is less than 10\")\n\n t.end()\n})\n"],"file":"lt.test.js"}
package/dist/map/map.js CHANGED
@@ -1,25 +1,14 @@
1
- "use strict";
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import { pipe } from "../pipe/pipe.js";
3
+ import { curry } from "../curry/curry.js";
2
4
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.map = void 0;
9
-
10
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
-
12
- var _pipe = require("../pipe/pipe");
13
-
14
- var _curry = require("../curry/curry");
15
-
16
- var _map = function _map(_fn, _source) {
5
+ var _map = function _map(_fn, _input) {
17
6
  var result = [];
18
- var source = Array.isArray(_source) ? _source : [_source];
19
- var fn = Array.isArray(_fn) ? _pipe.pipe.apply(void 0, (0, _toConsumableArray2.default)(_fn)) : _fn;
7
+ var input = Array.isArray(_input) ? _input : [_input];
8
+ var fn = Array.isArray(_fn) ? pipe.apply(void 0, _toConsumableArray(_fn)) : _fn;
20
9
 
21
- for (var i = 0, valuesCount = source.length; i < valuesCount; ++i) {
22
- result.push(fn(source[i], i, source));
10
+ for (var i = 0, valuesCount = input.length; i < valuesCount; ++i) {
11
+ result.push(fn(input[i], i, input));
23
12
  }
24
13
 
25
14
  return result;
@@ -28,14 +17,14 @@ var _map = function _map(_fn, _source) {
28
17
  * Iterates over an array and applies a function on each element, returning a
29
18
  * new array with the transformed elements.
30
19
  *
31
- * @param {Function|Function[]} fn Transform function called on each element
32
- * @param {Array} source Source array to iterate over
20
+ * @param {Function|Function[]} fn Transform function called on each element
21
+ * @param {Array} input Source array to iterate over
33
22
  *
34
23
  * @returns {Array} Returns new instance
35
24
  *
36
25
  * @name map
37
26
  * @tag Array
38
- * @signature (fn: Fn|Fn[], source: Array) => Array
27
+ * @signature (fn: Fn|Fn[], input: Array) => Array
39
28
  *
40
29
  * @see {@link mapMatrix}
41
30
  *
@@ -50,5 +39,5 @@ var _map = function _map(_fn, _source) {
50
39
  */
51
40
 
52
41
 
53
- var map = (0, _curry.curry)(_map);
54
- exports.map = map;
42
+ export var map = curry(_map);
43
+ //# sourceMappingURL=map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/map/map.js"],"names":["pipe","curry","_map","_fn","_input","result","input","Array","isArray","fn","i","valuesCount","length","push","map"],"mappings":";AAAA,SAASA,IAAT,QAAqB,iBAArB;AACA,SAASC,KAAT,QAAsB,mBAAtB;;AAEA,IAAMC,IAAI,GAAG,SAAPA,IAAO,CAACC,GAAD,EAAMC,MAAN,EAAiB;AAC5B,MAAMC,MAAM,GAAG,EAAf;AACA,MAAMC,KAAK,GAAGC,KAAK,CAACC,OAAN,CAAcJ,MAAd,IAAwBA,MAAxB,GAAiC,CAACA,MAAD,CAA/C;AACA,MAAMK,EAAE,GAAGF,KAAK,CAACC,OAAN,CAAcL,GAAd,IAAqBH,IAAI,MAAJ,4BAAQG,GAAR,EAArB,GAAoCA,GAA/C;;AAEA,OAAK,IAAIO,CAAC,GAAG,CAAR,EAAWC,WAAW,GAAGL,KAAK,CAACM,MAApC,EAA4CF,CAAC,GAAGC,WAAhD,EAA6D,EAAED,CAA/D,EAAkE;AAChEL,IAAAA,MAAM,CAACQ,IAAP,CAAYJ,EAAE,CAACH,KAAK,CAACI,CAAD,CAAN,EAAWA,CAAX,EAAcJ,KAAd,CAAd;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;AACA;AACA;AACA;;;AACA,OAAO,IAAMS,GAAG,GAAGb,KAAK,CAACC,IAAD,CAAjB","sourcesContent":["import { pipe } from \"../pipe/pipe.js\"\nimport { curry } from \"../curry/curry.js\"\n\nconst _map = (_fn, _input) => {\n const result = []\n const input = Array.isArray(_input) ? _input : [_input]\n const fn = Array.isArray(_fn) ? pipe(..._fn) : _fn\n\n for (let i = 0, valuesCount = input.length; i < valuesCount; ++i) {\n result.push(fn(input[i], i, input))\n }\n\n return result\n}\n\n/**\n * Iterates over an array and applies a function on each element, returning a\n * new array with the transformed elements.\n *\n * @param {Function|Function[]} fn Transform function called on each element\n * @param {Array} input Source array to iterate over\n *\n * @returns {Array} Returns new instance\n *\n * @name map\n * @tag Array\n * @signature (fn: Fn|Fn[], input: Array) => Array\n *\n * @see {@link mapMatrix}\n *\n * @example\n * const inc = x => x + 1\n *\n * map(inc, [1, 2])\n * // => [2, 3]\n *\n * map([inc, inc], [1, 2])\n * // => [3, 4]\n */\nexport const map = curry(_map)\n"],"file":"map.js"}
@@ -1,30 +1,26 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _tape = _interopRequireDefault(require("tape"));
6
-
7
- var _map = require("./map");
1
+ import test from "tape";
2
+ import { map } from "./map.js";
8
3
 
9
4
  var square = function square(value) {
10
5
  return value * value;
11
6
  };
12
7
 
13
- (0, _tape.default)("map", function (t) {
14
- t.deepEqual((0, _map.map)(square, [1, 2, 3]), [1, 4, 9], "(square, [1,2,3]) // => [1,4,9]");
15
- t.deepEqual((0, _map.map)(square)([1, 2, 3]), [1, 4, 9], "(square)([1,2,3]) // => [1,4,9]");
16
- t.deepEqual((0, _map.map)(square)(3), [9], "Run map for non-array input, treat as array of one");
17
- t.deepEqual((0, _map.map)([square, square], [1, 2, 3]), [1, 16, 81], "([square, square], [1,2,3]) // => [1,16,82]");
18
- t.deepEqual((0, _map.map)(square)([]), [], "iteration over [] should equal []");
19
- (0, _map.map)(function (currentValue, index, array) {
8
+ test("map", function (t) {
9
+ t.deepEqual(map(square, [1, 2, 3]), [1, 4, 9], "(square, [1,2,3]) // => [1,4,9]");
10
+ t.deepEqual(map(square)([1, 2, 3]), [1, 4, 9], "(square)([1,2,3]) // => [1,4,9]");
11
+ t.deepEqual(map(square)(3), [9], "Run map for non-array input, treat as array of one");
12
+ t.deepEqual(map([square, square], [1, 2, 3]), [1, 16, 81], "([square, square], [1,2,3]) // => [1,16,82]");
13
+ t.deepEqual(map(square)([]), [], "iteration over [] should equal []");
14
+ map(function (currentValue, index, array) {
20
15
  t.equal(currentValue, array[index], "callback element \"".concat(currentValue, "\" should equal [").concat(array, "][").concat(index, "]"));
21
16
  return currentValue * currentValue;
22
17
  })([1, 2]);
23
- (0, _map.map)([function (currentValue, index, array) {
18
+ map([function (currentValue, index, array) {
24
19
  t.equal(currentValue, array[index], "callback element \"".concat(currentValue, "\" should equal [").concat(array, "][").concat(index, "]"));
25
20
  return currentValue * currentValue;
26
21
  }], [1, 2]);
27
22
  var imutableTestArray = [1, 2, 3];
28
- t.notEqual((0, _map.map)(square)(imutableTestArray), imutableTestArray, "Imutable");
23
+ t.notEqual(map(square)(imutableTestArray), imutableTestArray, "Imutable");
29
24
  t.end();
30
- });
25
+ });
26
+ //# sourceMappingURL=map.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/map/map.test.js"],"names":["test","map","square","value","t","deepEqual","currentValue","index","array","equal","imutableTestArray","notEqual","end"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,MAAjB;AAEA,SAASC,GAAT,QAAoB,UAApB;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;AAAA,SAAIA,KAAK,GAAGA,KAAZ;AAAA,CAApB;;AAEAH,IAAI,CAAC,KAAD,EAAQ,UAAAI,CAAC,EAAI;AACfA,EAAAA,CAAC,CAACC,SAAF,CACEJ,GAAG,CAACC,MAAD,EAAS,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAAT,CADL,EAEE,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAFF,EAGE,iCAHF;AAMAE,EAAAA,CAAC,CAACC,SAAF,CACEJ,GAAG,CAACC,MAAD,CAAH,CAAY,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAAZ,CADF,EAEE,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAFF,EAGE,iCAHF;AAMAE,EAAAA,CAAC,CAACC,SAAF,CACEJ,GAAG,CAACC,MAAD,CAAH,CAAY,CAAZ,CADF,EAEE,CAAC,CAAD,CAFF,EAGE,oDAHF;AAMAE,EAAAA,CAAC,CAACC,SAAF,CACEJ,GAAG,CAAC,CAACC,MAAD,EAASA,MAAT,CAAD,EAAmB,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAAnB,CADL,EAEE,CAAC,CAAD,EAAI,EAAJ,EAAQ,EAAR,CAFF,EAGE,6CAHF;AAMAE,EAAAA,CAAC,CAACC,SAAF,CAAYJ,GAAG,CAACC,MAAD,CAAH,CAAY,EAAZ,CAAZ,EAA6B,EAA7B,EAAiC,mCAAjC;AAEAD,EAAAA,GAAG,CAAC,UAACK,YAAD,EAAeC,KAAf,EAAsBC,KAAtB,EAAgC;AAClCJ,IAAAA,CAAC,CAACK,KAAF,CACEH,YADF,EAEEE,KAAK,CAACD,KAAD,CAFP,+BAGuBD,YAHvB,8BAGsDE,KAHtD,eAGgED,KAHhE;AAMA,WAAOD,YAAY,GAAGA,YAAtB;AACD,GARE,CAAH,CAQG,CAAC,CAAD,EAAI,CAAJ,CARH;AAUAL,EAAAA,GAAG,CACD,CACE,UAACK,YAAD,EAAeC,KAAf,EAAsBC,KAAtB,EAAgC;AAC9BJ,IAAAA,CAAC,CAACK,KAAF,CACEH,YADF,EAEEE,KAAK,CAACD,KAAD,CAFP,+BAGuBD,YAHvB,8BAGsDE,KAHtD,eAGgED,KAHhE;AAMA,WAAOD,YAAY,GAAGA,YAAtB;AACD,GATH,CADC,EAYD,CAAC,CAAD,EAAI,CAAJ,CAZC,CAAH;AAeA,MAAMI,iBAAiB,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAA1B;AAEAN,EAAAA,CAAC,CAACO,QAAF,CAAWV,GAAG,CAACC,MAAD,CAAH,CAAYQ,iBAAZ,CAAX,EAA2CA,iBAA3C,EAA8D,UAA9D;AAEAN,EAAAA,CAAC,CAACQ,GAAF;AACD,CAzDG,CAAJ","sourcesContent":["import test from \"tape\"\n\nimport { map } from \"./map.js\"\n\nconst square = value => value * value\n\ntest(\"map\", t => {\n t.deepEqual(\n map(square, [1, 2, 3]),\n [1, 4, 9],\n \"(square, [1,2,3]) // => [1,4,9]\"\n )\n\n t.deepEqual(\n map(square)([1, 2, 3]),\n [1, 4, 9],\n \"(square)([1,2,3]) // => [1,4,9]\"\n )\n\n t.deepEqual(\n map(square)(3),\n [9],\n \"Run map for non-array input, treat as array of one\"\n )\n\n t.deepEqual(\n map([square, square], [1, 2, 3]),\n [1, 16, 81],\n \"([square, square], [1,2,3]) // => [1,16,82]\"\n )\n\n t.deepEqual(map(square)([]), [], \"iteration over [] should equal []\")\n\n map((currentValue, index, array) => {\n t.equal(\n currentValue,\n array[index],\n `callback element \"${currentValue}\" should equal [${array}][${index}]`\n )\n\n return currentValue * currentValue\n })([1, 2])\n\n map(\n [\n (currentValue, index, array) => {\n t.equal(\n currentValue,\n array[index],\n `callback element \"${currentValue}\" should equal [${array}][${index}]`\n )\n\n return currentValue * currentValue\n },\n ],\n [1, 2]\n )\n\n const imutableTestArray = [1, 2, 3]\n\n t.notEqual(map(square)(imutableTestArray), imutableTestArray, \"Imutable\")\n\n t.end()\n})\n"],"file":"map.test.js"}
@@ -1,27 +1,16 @@
1
- "use strict";
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import { curry } from "../curry/curry.js";
3
+ import { pipe } from "../pipe/pipe.js";
2
4
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.mapMatrix = void 0;
9
-
10
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
-
12
- var _curry = require("../curry/curry");
13
-
14
- var _pipe = require("../pipe/pipe");
15
-
16
- var _mapMatrix = function _mapMatrix(_fn, source) {
5
+ var _mapMatrix = function _mapMatrix(_fn, input) {
17
6
  var result = [];
18
- var fn = Array.isArray(_fn) ? _pipe.pipe.apply(void 0, (0, _toConsumableArray2.default)(_fn)) : _fn;
7
+ var fn = Array.isArray(_fn) ? pipe.apply(void 0, _toConsumableArray(_fn)) : _fn;
19
8
 
20
- for (var rowIndex = 0, rowCount = source.length; rowIndex < rowCount; ++rowIndex) {
9
+ for (var rowIndex = 0, rowCount = input.length; rowIndex < rowCount; ++rowIndex) {
21
10
  var row = [];
22
11
 
23
- for (var columnIndex = 0, columnCount = source[rowIndex].length; columnIndex < columnCount; ++columnIndex) {
24
- row.push(fn(source[rowIndex][columnIndex], rowIndex, columnIndex, source));
12
+ for (var columnIndex = 0, columnCount = input[rowIndex].length; columnIndex < columnCount; ++columnIndex) {
13
+ row.push(fn(input[rowIndex][columnIndex], rowIndex, columnIndex, input));
25
14
  }
26
15
 
27
16
  result.push(row);
@@ -34,15 +23,15 @@ var _mapMatrix = function _mapMatrix(_fn, source) {
34
23
  * a function on each element, returning a new matrix with the transformed
35
24
  * elements.
36
25
  *
37
- * @param {Function|Function[]} fn Transform function called on all elements
38
- * @param {any[][]} source Two-dimensional array to iterate over
26
+ * @param {Function|Function[]} fn Transform function called on all elements
27
+ * @param {any[][]} input Two-dimensional array to iterate over
39
28
  *
40
29
  * @returns {any[][]} New array instance
41
30
  *
42
31
  * @name mapMatrix
43
32
  * @tag Array
44
- * @signature (fn: Fn|Fn[]) => (source: [][]) => [][]
45
- * @signature (fn: Fn|Fn[], source: [][]) => [][]
33
+ * @signature (fn: Fn|Fn[]) => (input: [][]) => [][]
34
+ * @signature (fn: Fn|Fn[], input: [][]) => [][]
46
35
  *
47
36
  * @see {@link map}
48
37
  *
@@ -57,5 +46,5 @@ var _mapMatrix = function _mapMatrix(_fn, source) {
57
46
  */
58
47
 
59
48
 
60
- var mapMatrix = (0, _curry.curry)(_mapMatrix);
61
- exports.mapMatrix = mapMatrix;
49
+ export var mapMatrix = curry(_mapMatrix);
50
+ //# sourceMappingURL=map-matrix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/map-matrix/map-matrix.js"],"names":["curry","pipe","_mapMatrix","_fn","input","result","fn","Array","isArray","rowIndex","rowCount","length","row","columnIndex","columnCount","push","mapMatrix"],"mappings":";AAAA,SAASA,KAAT,QAAsB,mBAAtB;AACA,SAASC,IAAT,QAAqB,iBAArB;;AAEA,IAAMC,UAAU,GAAG,SAAbA,UAAa,CAACC,GAAD,EAAMC,KAAN,EAAgB;AACjC,MAAMC,MAAM,GAAG,EAAf;AACA,MAAMC,EAAE,GAAGC,KAAK,CAACC,OAAN,CAAcL,GAAd,IAAqBF,IAAI,MAAJ,4BAAQE,GAAR,EAArB,GAAoCA,GAA/C;;AAEA,OACE,IAAIM,QAAQ,GAAG,CAAf,EAAkBC,QAAQ,GAAGN,KAAK,CAACO,MADrC,EAEEF,QAAQ,GAAGC,QAFb,EAGE,EAAED,QAHJ,EAIE;AACA,QAAMG,GAAG,GAAG,EAAZ;;AAEA,SACE,IAAIC,WAAW,GAAG,CAAlB,EAAqBC,WAAW,GAAGV,KAAK,CAACK,QAAD,CAAL,CAAgBE,MADrD,EAEEE,WAAW,GAAGC,WAFhB,EAGE,EAAED,WAHJ,EAIE;AACAD,MAAAA,GAAG,CAACG,IAAJ,CAAST,EAAE,CAACF,KAAK,CAACK,QAAD,CAAL,CAAgBI,WAAhB,CAAD,EAA+BJ,QAA/B,EAAyCI,WAAzC,EAAsDT,KAAtD,CAAX;AACD;;AAEDC,IAAAA,MAAM,CAACU,IAAP,CAAYH,GAAZ;AACD;;AAED,SAAOP,MAAP;AACD,CAvBD;AAyBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,IAAMW,SAAS,GAAGhB,KAAK,CAACE,UAAD,CAAvB","sourcesContent":["import { curry } from \"../curry/curry.js\"\nimport { pipe } from \"../pipe/pipe.js\"\n\nconst _mapMatrix = (_fn, input) => {\n const result = []\n const fn = Array.isArray(_fn) ? pipe(..._fn) : _fn\n\n for (\n let rowIndex = 0, rowCount = input.length;\n rowIndex < rowCount;\n ++rowIndex\n ) {\n const row = []\n\n for (\n let columnIndex = 0, columnCount = input[rowIndex].length;\n columnIndex < columnCount;\n ++columnIndex\n ) {\n row.push(fn(input[rowIndex][columnIndex], rowIndex, columnIndex, input))\n }\n\n result.push(row)\n }\n\n return result\n}\n\n/**\n * Matrix version of \"map\". Iterates over a two-dimensional array and applies\n * a function on each element, returning a new matrix with the transformed\n * elements.\n *\n * @param {Function|Function[]} fn Transform function called on all elements\n * @param {any[][]} input Two-dimensional array to iterate over\n *\n * @returns {any[][]} New array instance\n *\n * @name mapMatrix\n * @tag Array\n * @signature (fn: Fn|Fn[]) => (input: [][]) => [][]\n * @signature (fn: Fn|Fn[], input: [][]) => [][]\n *\n * @see {@link map}\n *\n * @example\n * const inc = x => x + 1\n *\n * mapMatrix(inc, [[1, 2], [3, 4]])\n * // => [[2, 3], [4, 5]]\n *\n * mapMatrix([inc, inc], [[1, 2], [3, 4]])\n * // => [[3, 4], [5, 6]]\n */\nexport const mapMatrix = curry(_mapMatrix)\n"],"file":"map-matrix.js"}
@@ -1,10 +1,5 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _tape = _interopRequireDefault(require("tape"));
6
-
7
- var _mapMatrix = require("./map-matrix");
1
+ import test from "tape";
2
+ import { mapMatrix } from "./map-matrix.js";
8
3
 
9
4
  var square = function square(x) {
10
5
  return x * x;
@@ -14,13 +9,14 @@ var inc = function inc(x) {
14
9
  return x + 1;
15
10
  };
16
11
 
17
- (0, _tape.default)("mapMatrix", function (t) {
18
- t.deepEqual((0, _mapMatrix.mapMatrix)(square)([[1, 2], [3, 4]]), [[1, 4], [9, 16]], "Curried (square)([[1, 2], [3, 4]]) // => [[1, 4], [9, 16]]");
19
- t.deepEqual((0, _mapMatrix.mapMatrix)(square, [[1, 2], [3, 4]]), [[1, 4], [9, 16]], "Uncurried (square, [[1, 2], [3, 4]]) // => [[1, 4], [9, 16]]");
20
- t.deepEqual((0, _mapMatrix.mapMatrix)([square, inc], [[1, 2], [3, 4]]), [[2, 5], [10, 17]], "Multiple transform functions ([square, inc], [[1, 2], [3, 4]]) // => [[2, 5], [10, 17]]");
21
- (0, _mapMatrix.mapMatrix)(function (currentValue, rowIndex, columIndex, array) {
12
+ test("mapMatrix", function (t) {
13
+ t.deepEqual(mapMatrix(square)([[1, 2], [3, 4]]), [[1, 4], [9, 16]], "Curried (square)([[1, 2], [3, 4]]) // => [[1, 4], [9, 16]]");
14
+ t.deepEqual(mapMatrix(square, [[1, 2], [3, 4]]), [[1, 4], [9, 16]], "Uncurried (square, [[1, 2], [3, 4]]) // => [[1, 4], [9, 16]]");
15
+ t.deepEqual(mapMatrix([square, inc], [[1, 2], [3, 4]]), [[2, 5], [10, 17]], "Multiple transform functions ([square, inc], [[1, 2], [3, 4]]) // => [[2, 5], [10, 17]]");
16
+ mapMatrix(function (currentValue, rowIndex, columIndex, array) {
22
17
  t.equal(currentValue, array[rowIndex][columIndex], "callback element \"".concat(currentValue, "\" should equal [").concat(array, "][").concat(rowIndex, "][").concat(columIndex, "]"));
23
18
  return currentValue * currentValue;
24
19
  })([[1, 2]]);
25
20
  t.end();
26
- });
21
+ });
22
+ //# sourceMappingURL=map-matrix.test.js.map