@thi.ng/transducers 7.8.4 → 8.0.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 (299) hide show
  1. package/CHANGELOG.md +346 -467
  2. package/README.md +239 -214
  3. package/{rfn/add.d.ts → add.d.ts} +1 -1
  4. package/{rfn/add.js → add.js} +1 -1
  5. package/{iter/as-iterable.d.ts → as-iterable.d.ts} +0 -0
  6. package/{iter/as-iterable.js → as-iterable.js} +0 -0
  7. package/{rfn/assoc-map.d.ts → assoc-map.d.ts} +1 -1
  8. package/{rfn/assoc-map.js → assoc-map.js} +1 -1
  9. package/{rfn/assoc-obj.d.ts → assoc-obj.d.ts} +1 -1
  10. package/{rfn/assoc-obj.js → assoc-obj.js} +1 -1
  11. package/{rfn/auto-obj.d.ts → auto-obj.d.ts} +1 -1
  12. package/{rfn/auto-obj.js → auto-obj.js} +1 -1
  13. package/{xform/benchmark.d.ts → benchmark.d.ts} +1 -1
  14. package/{xform/benchmark.js → benchmark.js} +3 -3
  15. package/{xform/cat.d.ts → cat.d.ts} +1 -1
  16. package/{xform/cat.js → cat.js} +2 -2
  17. package/{iter/choices.d.ts → choices.d.ts} +1 -1
  18. package/{iter/choices.js → choices.js} +3 -2
  19. package/{func/comp.d.ts → comp.d.ts} +1 -1
  20. package/{func/comp.js → comp.js} +2 -2
  21. package/{func/compr.d.ts → compr.d.ts} +1 -1
  22. package/{func/compr.js → compr.js} +0 -0
  23. package/{iter/concat.d.ts → concat.d.ts} +0 -0
  24. package/{iter/concat.js → concat.js} +1 -1
  25. package/{rfn/conj.d.ts → conj.d.ts} +1 -1
  26. package/{rfn/conj.js → conj.js} +1 -1
  27. package/{xform/converge.d.ts → converge.d.ts} +2 -2
  28. package/{xform/converge.js → converge.js} +5 -5
  29. package/{xform/convolve.d.ts → convolve.d.ts} +1 -1
  30. package/{xform/convolve.js → convolve.js} +7 -7
  31. package/{rfn/count.d.ts → count.d.ts} +1 -1
  32. package/{rfn/count.js → count.js} +1 -1
  33. package/{iter/curve.d.ts → curve.d.ts} +0 -0
  34. package/{iter/curve.js → curve.js} +0 -0
  35. package/{iter/cycle.d.ts → cycle.d.ts} +0 -0
  36. package/{iter/cycle.js → cycle.js} +0 -0
  37. package/{xform/dedupe.d.ts → dedupe.d.ts} +2 -2
  38. package/{xform/dedupe.js → dedupe.js} +4 -4
  39. package/{func/deep-transform.d.ts → deep-transform.d.ts} +2 -2
  40. package/{func/deep-transform.js → deep-transform.js} +3 -3
  41. package/{xform/delayed.d.ts → delayed.d.ts} +1 -1
  42. package/{xform/delayed.js → delayed.js} +1 -1
  43. package/{xform/distinct.d.ts → distinct.d.ts} +1 -1
  44. package/{xform/distinct.js → distinct.js} +3 -3
  45. package/{rfn/div.d.ts → div.d.ts} +1 -1
  46. package/{rfn/div.js → div.js} +1 -1
  47. package/{xform/drop-nth.d.ts → drop-nth.d.ts} +1 -1
  48. package/{xform/drop-nth.js → drop-nth.js} +3 -3
  49. package/{xform/drop-while.d.ts → drop-while.d.ts} +1 -1
  50. package/{xform/drop-while.js → drop-while.js} +3 -3
  51. package/{xform/drop.d.ts → drop.d.ts} +1 -1
  52. package/{xform/drop.js → drop.js} +3 -3
  53. package/{iter/dup.d.ts → dup.d.ts} +0 -0
  54. package/{iter/dup.js → dup.js} +3 -2
  55. package/{xform/duplicate.d.ts → duplicate.d.ts} +1 -1
  56. package/{xform/duplicate.js → duplicate.js} +4 -4
  57. package/ensure.d.ts +3 -0
  58. package/{internal/ensure.js → ensure.js} +1 -1
  59. package/{rfn/every.d.ts → every.d.ts} +1 -1
  60. package/{rfn/every.js → every.js} +2 -2
  61. package/{iter/extend-sides.d.ts → extend-sides.d.ts} +0 -0
  62. package/{iter/extend-sides.js → extend-sides.js} +1 -1
  63. package/{rfn/fill.d.ts → fill.d.ts} +1 -1
  64. package/{rfn/fill.js → fill.js} +1 -1
  65. package/{xform/filter-fuzzy.d.ts → filter-fuzzy.d.ts} +1 -1
  66. package/{xform/filter-fuzzy.js → filter-fuzzy.js} +3 -3
  67. package/{xform/filter.d.ts → filter.d.ts} +1 -1
  68. package/{xform/filter.js → filter.js} +3 -3
  69. package/{xform/flatten-with.d.ts → flatten-with.d.ts} +4 -4
  70. package/{xform/flatten-with.js → flatten-with.js} +5 -4
  71. package/{xform/flatten.d.ts → flatten.d.ts} +4 -3
  72. package/{xform/flatten.js → flatten.js} +1 -1
  73. package/{rfn/frequencies.d.ts → frequencies.d.ts} +1 -1
  74. package/{rfn/frequencies.js → frequencies.js} +2 -2
  75. package/{rfn/group-binary.d.ts → group-binary.d.ts} +1 -1
  76. package/{rfn/group-binary.js → group-binary.js} +1 -1
  77. package/{rfn/group-by-map.d.ts → group-by-map.d.ts} +1 -1
  78. package/{rfn/group-by-map.js → group-by-map.js} +2 -2
  79. package/{rfn/group-by-obj.d.ts → group-by-obj.d.ts} +1 -1
  80. package/{rfn/group-by-obj.js → group-by-obj.js} +2 -2
  81. package/index.d.ts +138 -134
  82. package/index.js +142 -134
  83. package/{xform/indexed.d.ts → indexed.d.ts} +1 -1
  84. package/{xform/indexed.js → indexed.js} +2 -2
  85. package/{xform/interleave.d.ts → interleave.d.ts} +1 -1
  86. package/{xform/interleave.js → interleave.js} +4 -4
  87. package/internal/group-opts.js +6 -3
  88. package/internal/sort-opts.js +6 -3
  89. package/{xform/interpolate-hermite.d.ts → interpolate-hermite.d.ts} +1 -1
  90. package/{xform/interpolate-hermite.js → interpolate-hermite.js} +1 -1
  91. package/{xform/interpolate-linear.d.ts → interpolate-linear.d.ts} +1 -1
  92. package/{xform/interpolate-linear.js → interpolate-linear.js} +1 -1
  93. package/{xform/interpolate.d.ts → interpolate.d.ts} +1 -1
  94. package/{xform/interpolate.js → interpolate.js} +4 -5
  95. package/{xform/interpose.d.ts → interpose.d.ts} +1 -1
  96. package/{xform/interpose.js → interpose.js} +4 -4
  97. package/{iter/iterate.d.ts → iterate.d.ts} +0 -0
  98. package/{iter/iterate.js → iterate.js} +0 -0
  99. package/iterator.d.ts +2 -2
  100. package/iterator.js +5 -5
  101. package/{func/juxtr.d.ts → juxtr.d.ts} +1 -1
  102. package/{func/juxtr.js → juxtr.js} +1 -1
  103. package/{xform/keep.d.ts → keep.d.ts} +7 -1
  104. package/{xform/keep.js → keep.js} +4 -4
  105. package/{iter/key-permutations.d.ts → key-permutations.d.ts} +0 -0
  106. package/{iter/key-permutations.js → key-permutations.js} +4 -4
  107. package/{func/key-selector.d.ts → key-selector.d.ts} +0 -0
  108. package/{func/key-selector.js → key-selector.js} +0 -0
  109. package/{iter/keys.d.ts → keys.d.ts} +0 -0
  110. package/{iter/keys.js → keys.js} +0 -0
  111. package/{xform/labeled.d.ts → labeled.d.ts} +1 -1
  112. package/{xform/labeled.js → labeled.js} +3 -2
  113. package/{rfn/last.d.ts → last.d.ts} +1 -1
  114. package/{rfn/last.js → last.js} +2 -2
  115. package/{iter/line.d.ts → line.d.ts} +0 -0
  116. package/{iter/line.js → line.js} +1 -1
  117. package/{func/lookup.d.ts → lookup.d.ts} +0 -0
  118. package/{func/lookup.js → lookup.js} +0 -0
  119. package/{xform/map-deep.d.ts → map-deep.d.ts} +1 -1
  120. package/{xform/map-deep.js → map-deep.js} +3 -3
  121. package/{xform/map-indexed.d.ts → map-indexed.d.ts} +1 -1
  122. package/{xform/map-indexed.js → map-indexed.js} +3 -3
  123. package/{xform/map-keys.d.ts → map-keys.d.ts} +1 -1
  124. package/{xform/map-keys.js → map-keys.js} +2 -2
  125. package/{xform/map-nth.d.ts → map-nth.d.ts} +1 -1
  126. package/{xform/map-nth.js → map-nth.js} +3 -3
  127. package/{xform/map-vals.d.ts → map-vals.d.ts} +1 -1
  128. package/{xform/map-vals.js → map-vals.js} +2 -2
  129. package/{xform/map.d.ts → map.d.ts} +1 -1
  130. package/{xform/map.js → map.js} +3 -3
  131. package/{xform/mapcat-indexed.d.ts → mapcat-indexed.d.ts} +1 -1
  132. package/{xform/mapcat-indexed.js → mapcat-indexed.js} +3 -3
  133. package/{xform/mapcat.d.ts → mapcat.d.ts} +1 -1
  134. package/{xform/mapcat.js → mapcat.js} +3 -3
  135. package/{xform/match-first.d.ts → match-first.d.ts} +1 -1
  136. package/{xform/match-first.js → match-first.js} +3 -3
  137. package/{xform/match-last.d.ts → match-last.d.ts} +1 -1
  138. package/{xform/match-last.js → match-last.js} +3 -3
  139. package/{rfn/max-compare.d.ts → max-compare.d.ts} +1 -1
  140. package/{rfn/max-compare.js → max-compare.js} +2 -2
  141. package/{rfn/max-mag.d.ts → max-mag.d.ts} +1 -1
  142. package/{rfn/max-mag.js → max-mag.js} +1 -1
  143. package/{rfn/max.d.ts → max.d.ts} +1 -1
  144. package/{rfn/max.js → max.js} +1 -1
  145. package/{rfn/mean.d.ts → mean.d.ts} +1 -1
  146. package/{rfn/mean.js → mean.js} +1 -1
  147. package/{rfn/min-compare.d.ts → min-compare.d.ts} +1 -1
  148. package/{rfn/min-compare.js → min-compare.js} +2 -2
  149. package/{rfn/min-mag.d.ts → min-mag.d.ts} +1 -1
  150. package/{rfn/min-mag.js → min-mag.js} +1 -1
  151. package/{rfn/min-max.d.ts → min-max.d.ts} +1 -1
  152. package/{rfn/min-max.js → min-max.js} +1 -1
  153. package/{rfn/min.d.ts → min.d.ts} +1 -1
  154. package/{rfn/min.js → min.js} +1 -1
  155. package/{xform/moving-average.d.ts → moving-average.d.ts} +1 -1
  156. package/{xform/moving-average.js → moving-average.js} +4 -4
  157. package/{xform/moving-median.d.ts → moving-median.d.ts} +1 -1
  158. package/{xform/moving-median.js → moving-median.js} +4 -4
  159. package/{rfn/mul.d.ts → mul.d.ts} +1 -1
  160. package/{rfn/mul.js → mul.js} +1 -1
  161. package/{xform/multiplex-obj.d.ts → multiplex-obj.d.ts} +1 -1
  162. package/{xform/multiplex-obj.js → multiplex-obj.js} +3 -3
  163. package/{xform/multiplex.d.ts → multiplex.d.ts} +1 -1
  164. package/{xform/multiplex.js → multiplex.js} +2 -2
  165. package/{xform/noop.d.ts → noop.d.ts} +1 -1
  166. package/{xform/noop.js → noop.js} +0 -0
  167. package/norm-count.d.ts +24 -0
  168. package/norm-count.js +9 -0
  169. package/norm-frequencies-auto.d.ts +23 -0
  170. package/norm-frequencies-auto.js +21 -0
  171. package/norm-frequencies.d.ts +21 -0
  172. package/norm-frequencies.js +11 -0
  173. package/{iter/norm-range.d.ts → norm-range.d.ts} +0 -0
  174. package/{iter/norm-range.js → norm-range.js} +1 -1
  175. package/package.json +467 -34
  176. package/{xform/pad-last.d.ts → pad-last.d.ts} +1 -1
  177. package/{xform/pad-last.js → pad-last.js} +3 -3
  178. package/{iter/pad-sides.d.ts → pad-sides.d.ts} +0 -0
  179. package/{iter/pad-sides.js → pad-sides.js} +0 -0
  180. package/{xform/page.d.ts → page.d.ts} +1 -1
  181. package/{xform/page.js → page.js} +3 -3
  182. package/{iter/pairs.d.ts → pairs.d.ts} +0 -0
  183. package/{iter/pairs.js → pairs.js} +0 -0
  184. package/{iter/palindrome.d.ts → palindrome.d.ts} +0 -0
  185. package/{iter/palindrome.js → palindrome.js} +4 -3
  186. package/{xform/partition-by.d.ts → partition-by.d.ts} +2 -2
  187. package/{xform/partition-by.js → partition-by.js} +4 -4
  188. package/{xform/partition-of.d.ts → partition-of.d.ts} +1 -1
  189. package/{xform/partition-of.js → partition-of.js} +2 -2
  190. package/{xform/partition-sort.d.ts → partition-sort.d.ts} +1 -1
  191. package/{xform/partition-sort.js → partition-sort.js} +4 -4
  192. package/{xform/partition-sync.d.ts → partition-sync.d.ts} +1 -1
  193. package/{xform/partition-sync.js → partition-sync.js} +15 -8
  194. package/{xform/partition-time.d.ts → partition-time.d.ts} +1 -1
  195. package/{xform/partition-time.js → partition-time.js} +2 -2
  196. package/{xform/partition-when.d.ts → partition-when.d.ts} +1 -1
  197. package/{xform/partition-when.js → partition-when.js} +3 -3
  198. package/{xform/partition.d.ts → partition.d.ts} +1 -1
  199. package/{xform/partition.js → partition.js} +2 -2
  200. package/{xform/peek.d.ts → peek.d.ts} +1 -1
  201. package/{xform/peek.js → peek.js} +1 -1
  202. package/{iter/permutations.d.ts → permutations.d.ts} +0 -0
  203. package/{iter/permutations.js → permutations.js} +2 -2
  204. package/{xform/pluck.d.ts → pluck.d.ts} +1 -1
  205. package/{xform/pluck.js → pluck.js} +2 -2
  206. package/push-copy.d.ts +3 -0
  207. package/{rfn/push-copy.js → push-copy.js} +1 -1
  208. package/{rfn/push-sort.d.ts → push-sort.d.ts} +1 -1
  209. package/{rfn/push-sort.js → push-sort.js} +1 -1
  210. package/{rfn/push.d.ts → push.d.ts} +1 -1
  211. package/{rfn/push.js → push.js} +1 -1
  212. package/{iter/range-nd.d.ts → range-nd.d.ts} +0 -0
  213. package/{iter/range-nd.js → range-nd.js} +1 -1
  214. package/{iter/range.d.ts → range.d.ts} +2 -2
  215. package/{iter/range.js → range.js} +4 -1
  216. package/{iter/range2d.d.ts → range2d.d.ts} +0 -0
  217. package/{iter/range2d.js → range2d.js} +1 -1
  218. package/{iter/range3d.d.ts → range3d.d.ts} +0 -0
  219. package/{iter/range3d.js → range3d.js} +1 -1
  220. package/reduce.js +4 -2
  221. package/reduced.js +1 -0
  222. package/{rfn/reductions.d.ts → reductions.d.ts} +1 -1
  223. package/{rfn/reductions.js → reductions.js} +2 -2
  224. package/{xform/rename.d.ts → rename.d.ts} +1 -1
  225. package/{xform/rename.js → rename.js} +6 -6
  226. package/renamer.d.ts +9 -0
  227. package/{func/renamer.js → renamer.js} +6 -0
  228. package/{iter/repeat.d.ts → repeat.d.ts} +0 -0
  229. package/{iter/repeat.js → repeat.js} +0 -0
  230. package/{iter/repeatedly.d.ts → repeatedly.d.ts} +0 -0
  231. package/{iter/repeatedly.js → repeatedly.js} +0 -0
  232. package/{iter/reverse.d.ts → reverse.d.ts} +0 -0
  233. package/{iter/reverse.js → reverse.js} +1 -1
  234. package/run.d.ts +1 -1
  235. package/run.js +1 -1
  236. package/{xform/sample.d.ts → sample.d.ts} +2 -2
  237. package/{xform/sample.js → sample.js} +4 -4
  238. package/{xform/scan.d.ts → scan.d.ts} +1 -1
  239. package/{xform/scan.js → scan.js} +3 -3
  240. package/{xform/select-keys.d.ts → select-keys.d.ts} +1 -1
  241. package/{xform/select-keys.js → select-keys.js} +3 -3
  242. package/{xform/side-effect.d.ts → side-effect.d.ts} +1 -1
  243. package/{xform/side-effect.js → side-effect.js} +0 -0
  244. package/{xform/sliding-window.d.ts → sliding-window.d.ts} +2 -2
  245. package/{xform/sliding-window.js → sliding-window.js} +4 -4
  246. package/{rfn/some.d.ts → some.d.ts} +1 -1
  247. package/{rfn/some.js → some.js} +2 -2
  248. package/{iter/sorted-keys.d.ts → sorted-keys.d.ts} +0 -0
  249. package/{iter/sorted-keys.js → sorted-keys.js} +1 -1
  250. package/step.js +2 -2
  251. package/{rfn/str.d.ts → str.d.ts} +1 -1
  252. package/{rfn/str.js → str.js} +1 -1
  253. package/{xform/stream-shuffle.d.ts → stream-shuffle.d.ts} +1 -1
  254. package/{xform/stream-shuffle.js → stream-shuffle.js} +4 -4
  255. package/{xform/stream-sort.d.ts → stream-sort.d.ts} +1 -1
  256. package/{xform/stream-sort.js → stream-sort.js} +5 -5
  257. package/{xform/struct.d.ts → struct.d.ts} +1 -1
  258. package/{xform/struct.js → struct.js} +3 -3
  259. package/{rfn/sub.d.ts → sub.d.ts} +1 -1
  260. package/{rfn/sub.js → sub.js} +1 -1
  261. package/{xform/swizzle.d.ts → swizzle.d.ts} +1 -1
  262. package/{xform/swizzle.js → swizzle.js} +3 -3
  263. package/{iter/symmetric.d.ts → symmetric.d.ts} +0 -0
  264. package/{iter/symmetric.js → symmetric.js} +0 -0
  265. package/{xform/take-last.d.ts → take-last.d.ts} +1 -1
  266. package/{xform/take-last.js → take-last.js} +3 -3
  267. package/{xform/take-nth.d.ts → take-nth.d.ts} +1 -1
  268. package/{xform/take-nth.js → take-nth.js} +3 -3
  269. package/{xform/take-while.d.ts → take-while.d.ts} +1 -1
  270. package/{xform/take-while.js → take-while.js} +4 -4
  271. package/{xform/take.d.ts → take.d.ts} +1 -1
  272. package/{xform/take.js → take.js} +4 -4
  273. package/{xform/throttle-time.d.ts → throttle-time.d.ts} +1 -1
  274. package/{xform/throttle-time.js → throttle-time.js} +2 -2
  275. package/{xform/throttle.d.ts → throttle.d.ts} +1 -1
  276. package/{xform/throttle.js → throttle.js} +3 -3
  277. package/{xform/toggle.d.ts → toggle.d.ts} +1 -1
  278. package/{xform/toggle.js → toggle.js} +2 -2
  279. package/trace.d.ts +3 -0
  280. package/{xform/trace.js → trace.js} +0 -0
  281. package/transduce.js +3 -3
  282. package/{iter/tween.d.ts → tween.d.ts} +0 -0
  283. package/{iter/tween.js → tween.js} +0 -0
  284. package/{iter/vals.d.ts → vals.d.ts} +0 -0
  285. package/{iter/vals.js → vals.js} +0 -0
  286. package/{xform/word-wrap.d.ts → word-wrap.d.ts} +1 -1
  287. package/{xform/word-wrap.js → word-wrap.js} +7 -3
  288. package/{iter/wrap-sides.d.ts → wrap-sides.d.ts} +0 -0
  289. package/{iter/wrap-sides.js → wrap-sides.js} +3 -3
  290. package/{iter/zip.d.ts → zip.d.ts} +0 -0
  291. package/{iter/zip.js → zip.js} +0 -0
  292. package/func/renamer.d.ts +0 -3
  293. package/internal/ensure.d.ts +0 -3
  294. package/lib/index.js +0 -2188
  295. package/lib/index.js.map +0 -1
  296. package/lib/index.umd.js +0 -1
  297. package/lib/index.umd.js.map +0 -1
  298. package/rfn/push-copy.d.ts +0 -3
  299. package/xform/trace.d.ts +0 -3
@@ -1,4 +1,4 @@
1
- import type { Reducer } from "../api";
1
+ import type { Reducer } from "./api";
2
2
  /**
3
3
  * Reducer to compute sum of values with given `init` value. Default: 0
4
4
  */
@@ -1,4 +1,4 @@
1
- import { __mathop } from "../internal/mathop";
1
+ import { __mathop } from "./internal/mathop";
2
2
  export function add(...args) {
3
3
  return __mathop(add, (acc, x) => acc + x, 0, args);
4
4
  }
File without changes
File without changes
@@ -1,5 +1,5 @@
1
1
  import type { Pair } from "@thi.ng/api";
2
- import type { Reducer } from "../api";
2
+ import type { Reducer } from "./api";
3
3
  /**
4
4
  * Reducer accepting key-value pairs / tuples and transforming / adding
5
5
  * them to an ES6 Map.
@@ -1,4 +1,4 @@
1
- import { reduce, reducer } from "../reduce";
1
+ import { reduce, reducer } from "./reduce";
2
2
  export function assocMap(xs) {
3
3
  return xs
4
4
  ? reduce(assocMap(), xs)
@@ -1,5 +1,5 @@
1
1
  import type { IObjectOf, Pair } from "@thi.ng/api";
2
- import type { Reducer } from "../api";
2
+ import type { Reducer } from "./api";
3
3
  /**
4
4
  * Reducer accepting key-value pairs / tuples and updating / adding them
5
5
  * to an object.
@@ -1,4 +1,4 @@
1
- import { reduce, reducer } from "../reduce";
1
+ import { reduce, reducer } from "./reduce";
2
2
  export function assocObj(xs) {
3
3
  return xs
4
4
  ? reduce(assocObj(), xs)
@@ -1,5 +1,5 @@
1
1
  import type { IObjectOf } from "@thi.ng/api";
2
- import type { Reducer } from "../api";
2
+ import type { Reducer } from "./api";
3
3
  /**
4
4
  * Reducer accepting values of any type and assigning them to auto-labeled keys
5
5
  * in an object. Keys consist of given `prefix` and monotonically increasing ID.
@@ -1,4 +1,4 @@
1
- import { reduce, reducer } from "../reduce";
1
+ import { reduce, reducer } from "./reduce";
2
2
  export function autoObj(prefix, xs) {
3
3
  let id = 0;
4
4
  return xs
@@ -1,4 +1,4 @@
1
- import type { Transducer } from "../api";
1
+ import type { Transducer } from "./api";
2
2
  /**
3
3
  * Stateful transducer. Ignores the actual input values, but
4
4
  * produces time measurements since last value processed,
@@ -1,6 +1,6 @@
1
- import { isIterable } from "@thi.ng/checks";
2
- import { compR } from "../func/compr";
3
- import { iterator1 } from "../iterator";
1
+ import { isIterable } from "@thi.ng/checks/is-iterable";
2
+ import { compR } from "./compr";
3
+ import { iterator1 } from "./iterator";
4
4
  export function benchmark(src) {
5
5
  return isIterable(src)
6
6
  ? iterator1(benchmark(), src)
@@ -1,5 +1,5 @@
1
1
  import type { Nullable } from "@thi.ng/api";
2
- import type { Transducer } from "../api";
2
+ import type { Transducer } from "./api";
3
3
  /**
4
4
  * Transducer to concatenate iterable values. Iterates over each input
5
5
  * and emits individual values down stream, therefore removing one level
@@ -1,5 +1,5 @@
1
- import { compR } from "../func/compr";
2
- import { ensureReduced, isReduced, unreduced } from "../reduced";
1
+ import { compR } from "./compr";
2
+ import { ensureReduced, isReduced, unreduced } from "./reduced";
3
3
  /**
4
4
  * Transducer to concatenate iterable values. Iterates over each input
5
5
  * and emits individual values down stream, therefore removing one level
@@ -1,4 +1,4 @@
1
- import { IRandom } from "@thi.ng/random";
1
+ import type { IRandom } from "@thi.ng/random";
2
2
  /**
3
3
  * Returns an infinite iterator of random choices and their (optional)
4
4
  * weights. If `weights` is given, it must have at least the same size
@@ -1,5 +1,6 @@
1
- import { ensureArray } from "@thi.ng/arrays";
2
- import { SYSTEM, weightedRandom } from "@thi.ng/random";
1
+ import { ensureArray } from "@thi.ng/arrays/ensure-array";
2
+ import { SYSTEM } from "@thi.ng/random/system";
3
+ import { weightedRandom } from "@thi.ng/random/weighted-random";
3
4
  import { repeatedly } from "./repeatedly";
4
5
  /**
5
6
  * Returns an infinite iterator of random choices and their (optional)
@@ -1,4 +1,4 @@
1
- import type { Transducer, TxLike } from "../api";
1
+ import type { Transducer, TxLike } from "./api";
2
2
  /**
3
3
  * Transducer composition. Returns new transducer which applies given
4
4
  * transducers in left-to-right order.
@@ -1,5 +1,5 @@
1
- import { comp as _comp } from "@thi.ng/compose";
2
- import { ensureTransducer } from "../internal/ensure";
1
+ import { comp as _comp } from "@thi.ng/compose/comp";
2
+ import { ensureTransducer } from "./ensure";
3
3
  export function comp(...fns) {
4
4
  fns = fns.map(ensureTransducer);
5
5
  return _comp.apply(null, fns);
@@ -1,4 +1,4 @@
1
- import type { Reducer, ReductionFn } from "../api";
1
+ import type { Reducer, ReductionFn } from "./api";
2
2
  /**
3
3
  * Reducer composition helper, internally used by various transducers
4
4
  * during initialization. Takes existing reducer `rfn` (a 3-tuple) and a
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- import { ensureIterable } from "@thi.ng/arrays";
1
+ import { ensureIterable } from "@thi.ng/arrays/ensure-iterable";
2
2
  /**
3
3
  * Yields iterator producing concatenation of given iterables.
4
4
  * Undefined & null inputs are silently ignored, however any
@@ -1,4 +1,4 @@
1
- import type { Reducer } from "../api";
1
+ import type { Reducer } from "./api";
2
2
  /**
3
3
  * Reducer. Like {@link (push:1)}, but for ES6 Sets.
4
4
  */
@@ -1,4 +1,4 @@
1
- import { reduce, reducer } from "../reduce";
1
+ import { reduce, reducer } from "./reduce";
2
2
  export function conj(xs) {
3
3
  return xs
4
4
  ? reduce(conj(), xs)
@@ -1,5 +1,5 @@
1
- import { Predicate2 } from "@thi.ng/api";
2
- import type { Transducer } from "../api";
1
+ import type { Predicate2 } from "@thi.ng/api";
2
+ import type { Transducer } from "./api";
3
3
  /**
4
4
  * Transducer which for each input `x` (apart from the very first one)
5
5
  * applies given predicate `pred` to previous input and `x`. Only passes
@@ -1,9 +1,9 @@
1
- import { SEMAPHORE } from "@thi.ng/api";
2
- import { compR } from "../func/compr";
3
- import { $iter } from "../iterator";
4
- import { ensureReduced } from "../reduced";
1
+ import { SEMAPHORE } from "@thi.ng/api/api";
2
+ import { compR } from "./compr";
3
+ import { __iter } from "./iterator";
4
+ import { ensureReduced } from "./reduced";
5
5
  export function converge(...args) {
6
- return ($iter(converge, args) ||
6
+ return (__iter(converge, args) ||
7
7
  ((rfn) => {
8
8
  const r = rfn[2];
9
9
  const pred = args[0];
@@ -1,5 +1,5 @@
1
1
  import type { Fn0 } from "@thi.ng/api";
2
- import type { Reducer, Transducer } from "../api";
2
+ import type { Reducer, Transducer } from "./api";
3
3
  export declare type ConvolutionKernel1D = [number, number][];
4
4
  export declare type ConvolutionKernel2D = [number, [number, number]][];
5
5
  export declare type ConvolutionKernel3D = [number, [number, number, number]][];
@@ -1,11 +1,11 @@
1
- import { illegalArgs } from "@thi.ng/errors";
2
- import { range } from "../iter/range";
3
- import { range2d } from "../iter/range2d";
4
- import { zip } from "../iter/zip";
5
- import { iterator1 } from "../iterator";
6
- import { add } from "../rfn/add";
7
- import { transduce } from "../transduce";
1
+ import { illegalArgs } from "@thi.ng/errors/illegal-arguments";
2
+ import { add } from "./add";
3
+ import { iterator1 } from "./iterator";
8
4
  import { map } from "./map";
5
+ import { range } from "./range";
6
+ import { range2d } from "./range2d";
7
+ import { transduce } from "./transduce";
8
+ import { zip } from "./zip";
9
9
  export const buildKernel1d = (weights, w) => {
10
10
  const w2 = w >> 1;
11
11
  return [...zip(weights, range(-w2, w2 + 1))];
@@ -1,4 +1,4 @@
1
- import type { Reducer } from "../api";
1
+ import type { Reducer } from "./api";
2
2
  /**
3
3
  * Reducer which ignores incoming values and instead only counts them,
4
4
  * optionally using given `start` and `step` counter values.
@@ -1,4 +1,4 @@
1
- import { $$reduce, reducer } from "../reduce";
1
+ import { $$reduce, reducer } from "./reduce";
2
2
  export function count(...args) {
3
3
  const res = $$reduce(count, args);
4
4
  if (res !== undefined) {
File without changes
File without changes
File without changes
File without changes
@@ -1,5 +1,5 @@
1
- import { Predicate2 } from "@thi.ng/api";
2
- import type { Transducer } from "../api";
1
+ import type { Predicate2 } from "@thi.ng/api";
2
+ import type { Transducer } from "./api";
3
3
  export declare function dedupe<T>(equiv?: Predicate2<T>): Transducer<T, T>;
4
4
  export declare function dedupe<T>(src: Iterable<T>): IterableIterator<T>;
5
5
  export declare function dedupe<T>(equiv: Predicate2<T>, src: Iterable<T>): IterableIterator<T>;
@@ -1,8 +1,8 @@
1
- import { SEMAPHORE } from "@thi.ng/api";
2
- import { compR } from "../func/compr";
3
- import { $iter } from "../iterator";
1
+ import { SEMAPHORE } from "@thi.ng/api/api";
2
+ import { compR } from "./compr";
3
+ import { __iter } from "./iterator";
4
4
  export function dedupe(...args) {
5
- return ($iter(dedupe, args) ||
5
+ return (__iter(dedupe, args) ||
6
6
  ((rfn) => {
7
7
  const r = rfn[2];
8
8
  const equiv = args[0];
@@ -1,4 +1,4 @@
1
- import type { TransformSpec } from "../api";
1
+ import type { TransformSpec } from "./api";
2
2
  /**
3
3
  * Higher-order deep object transformer used by {@link (mapDeep:1)}.
4
4
  * Accepts a nested `spec` array reflecting same key structure as the
@@ -56,7 +56,7 @@ import type { TransformSpec } from "../api";
56
56
  * // [ "h1", "Hello world" ],
57
57
  * // [ "div.meta",
58
58
  * // [ "a", { href: "mailto:a@.b.com" }, "Alice" ],
59
- * // "(1/2/2003, 12:34:56 PM)" ],
59
+ * // "./2/2003, 12:34:56 PM)" ],
60
60
  * // "Ratione necessitatibus doloremque itaque." ]
61
61
  * ```
62
62
  *
@@ -1,4 +1,4 @@
1
- import { isFunction } from "@thi.ng/checks";
1
+ import { isFunction } from "@thi.ng/checks/is-function";
2
2
  /**
3
3
  * Higher-order deep object transformer used by {@link (mapDeep:1)}.
4
4
  * Accepts a nested `spec` array reflecting same key structure as the
@@ -56,7 +56,7 @@ import { isFunction } from "@thi.ng/checks";
56
56
  * // [ "h1", "Hello world" ],
57
57
  * // [ "div.meta",
58
58
  * // [ "a", { href: "mailto:a@.b.com" }, "Alice" ],
59
- * // "(1/2/2003, 12:34:56 PM)" ],
59
+ * // "./2/2003, 12:34:56 PM)" ],
60
60
  * // "Ratione necessitatibus doloremque itaque." ]
61
61
  * ```
62
62
  *
@@ -68,7 +68,7 @@ export const deepTransform = (spec) => {
68
68
  }
69
69
  const mapfns = Object.keys(spec[1] || {}).reduce((acc, k) => ((acc[k] = deepTransform(spec[1][k])), acc), {});
70
70
  return (x) => {
71
- const res = Object.assign({}, x);
71
+ const res = { ...x };
72
72
  for (let k in mapfns) {
73
73
  res[k] = mapfns[k](res[k]);
74
74
  }
@@ -1,4 +1,4 @@
1
- import type { Transducer } from "../api";
1
+ import type { Transducer } from "./api";
2
2
  /**
3
3
  * Yields transducer which wraps incoming values in promises, which each
4
4
  * resolve after specified delay time (in ms).
@@ -1,4 +1,4 @@
1
- import { delayed as _delayed } from "@thi.ng/compose";
1
+ import { delayed as _delayed } from "@thi.ng/compose/delayed";
2
2
  import { map } from "./map";
3
3
  /**
4
4
  * Yields transducer which wraps incoming values in promises, which each
@@ -1,5 +1,5 @@
1
1
  import type { Fn, Fn0 } from "@thi.ng/api";
2
- import type { Transducer } from "../api";
2
+ import type { Transducer } from "./api";
3
3
  export interface DistinctOpts<T> {
4
4
  /**
5
5
  * Key extractor function.
@@ -1,7 +1,7 @@
1
- import { compR } from "../func/compr";
2
- import { $iter } from "../iterator";
1
+ import { compR } from "./compr";
2
+ import { __iter } from "./iterator";
3
3
  export function distinct(...args) {
4
- return ($iter(distinct, args) ||
4
+ return (__iter(distinct, args) ||
5
5
  ((rfn) => {
6
6
  const r = rfn[2];
7
7
  const opts = (args[0] || {});
@@ -1,4 +1,4 @@
1
- import type { Reducer } from "../api";
1
+ import type { Reducer } from "./api";
2
2
  /**
3
3
  * Reducer to compute successive division of values using given `init`
4
4
  * value.
@@ -1,4 +1,4 @@
1
- import { reduce, reducer } from "../reduce";
1
+ import { reduce, reducer } from "./reduce";
2
2
  export function div(init, xs) {
3
3
  return xs
4
4
  ? reduce(div(init), xs)
@@ -1,4 +1,4 @@
1
- import type { Transducer } from "../api";
1
+ import type { Transducer } from "./api";
2
2
  export declare function dropNth<T>(n: number): Transducer<T, T>;
3
3
  export declare function dropNth<T>(n: number, src: Iterable<T>): IterableIterator<T>;
4
4
  //# sourceMappingURL=drop-nth.d.ts.map
@@ -1,6 +1,6 @@
1
- import { isIterable } from "@thi.ng/checks";
2
- import { clamp0 } from "@thi.ng/math";
3
- import { iterator1 } from "../iterator";
1
+ import { isIterable } from "@thi.ng/checks/is-iterable";
2
+ import { clamp0 } from "@thi.ng/math/interval";
3
+ import { iterator1 } from "./iterator";
4
4
  import { throttle } from "./throttle";
5
5
  export function dropNth(n, src) {
6
6
  if (isIterable(src)) {
@@ -1,5 +1,5 @@
1
1
  import type { Predicate } from "@thi.ng/api";
2
- import type { Transducer } from "../api";
2
+ import type { Transducer } from "./api";
3
3
  export declare function dropWhile<T>(pred?: Predicate<T>): Transducer<T, T>;
4
4
  export declare function dropWhile<T>(src: Iterable<T>): IterableIterator<T>;
5
5
  export declare function dropWhile<T>(pred: Predicate<T>, src: Iterable<T>): IterableIterator<T>;
@@ -1,7 +1,7 @@
1
- import { compR } from "../func/compr";
2
- import { $iter } from "../iterator";
1
+ import { compR } from "./compr";
2
+ import { __iter } from "./iterator";
3
3
  export function dropWhile(...args) {
4
- return ($iter(dropWhile, args) ||
4
+ return (__iter(dropWhile, args) ||
5
5
  ((rfn) => {
6
6
  const r = rfn[2];
7
7
  const pred = args[0];
@@ -1,4 +1,4 @@
1
- import type { Transducer } from "../api";
1
+ import type { Transducer } from "./api";
2
2
  export declare function drop<T>(n: number): Transducer<T, T>;
3
3
  export declare function drop<T>(n: number, src: Iterable<T>): IterableIterator<T>;
4
4
  //# sourceMappingURL=drop.d.ts.map
@@ -1,6 +1,6 @@
1
- import { isIterable } from "@thi.ng/checks";
2
- import { compR } from "../func/compr";
3
- import { iterator1 } from "../iterator";
1
+ import { isIterable } from "@thi.ng/checks/is-iterable";
2
+ import { compR } from "./compr";
3
+ import { iterator1 } from "./iterator";
4
4
  export function drop(n, src) {
5
5
  return isIterable(src)
6
6
  ? iterator1(drop(n), src)
File without changes
@@ -1,5 +1,6 @@
1
- import { ensureArray } from "@thi.ng/arrays";
2
- import { isArray, isString } from "@thi.ng/checks";
1
+ import { ensureArray } from "@thi.ng/arrays/ensure-array";
2
+ import { isArray } from "@thi.ng/checks/is-array";
3
+ import { isString } from "@thi.ng/checks/is-string";
3
4
  import { concat } from "./concat";
4
5
  export function dup(x) {
5
6
  return isString(x)
@@ -1,4 +1,4 @@
1
- import type { Transducer } from "../api";
1
+ import type { Transducer } from "./api";
2
2
  export declare function duplicate<T>(n?: number): Transducer<T, T>;
3
3
  export declare function duplicate<T>(n: number, src: Iterable<T>): IterableIterator<T>;
4
4
  //# sourceMappingURL=duplicate.d.ts.map
@@ -1,7 +1,7 @@
1
- import { isIterable } from "@thi.ng/checks";
2
- import { compR } from "../func/compr";
3
- import { iterator } from "../iterator";
4
- import { isReduced } from "../reduced";
1
+ import { isIterable } from "@thi.ng/checks/is-iterable";
2
+ import { compR } from "./compr";
3
+ import { iterator } from "./iterator";
4
+ import { isReduced } from "./reduced";
5
5
  export function duplicate(n = 1, src) {
6
6
  return isIterable(src)
7
7
  ? iterator(duplicate(n), src)
package/ensure.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import type { Transducer, TxLike } from "./api";
2
+ export declare const ensureTransducer: <A, B>(x: TxLike<A, B>) => Transducer<A, B>;
3
+ //# sourceMappingURL=ensure.d.ts.map
@@ -1,2 +1,2 @@
1
- import { implementsFunction } from "@thi.ng/checks";
1
+ import { implementsFunction } from "@thi.ng/checks/implements-function";
2
2
  export const ensureTransducer = (x) => implementsFunction(x, "xform") ? x.xform() : x;
@@ -1,5 +1,5 @@
1
1
  import type { Predicate } from "@thi.ng/api";
2
- import type { Reducer } from "../api";
2
+ import type { Reducer } from "./api";
3
3
  /**
4
4
  * Reducer which applies optional `pred` function to each value and
5
5
  * terminates early if the predicate returned a falsy result. If no
@@ -1,5 +1,5 @@
1
- import { $$reduce, reducer } from "../reduce";
2
- import { reduced } from "../reduced";
1
+ import { $$reduce, reducer } from "./reduce";
2
+ import { reduced } from "./reduced";
3
3
  export function every(...args) {
4
4
  const res = $$reduce(every, args);
5
5
  if (res !== undefined) {
File without changes
@@ -1,4 +1,4 @@
1
- import { SEMAPHORE } from "@thi.ng/api";
1
+ import { SEMAPHORE } from "@thi.ng/api/api";
2
2
  import { repeat } from "./repeat";
3
3
  /**
4
4
  * Yields iterator of given iterable which repeats the first and/or last
@@ -1,5 +1,5 @@
1
1
  import type { NumericArray } from "@thi.ng/api";
2
- import type { Reducer } from "../api";
2
+ import type { Reducer } from "./api";
3
3
  /**
4
4
  * Reducer which starts filling array with results from given `start`
5
5
  * index (default: 0). Use {@link (fillN:1)} for typed array targets
@@ -1,4 +1,4 @@
1
- import { $$reduce, reducer } from "../reduce";
1
+ import { $$reduce, reducer } from "./reduce";
2
2
  export function fill(...args) {
3
3
  const res = $$reduce(fill, args);
4
4
  if (res !== undefined) {
@@ -1,5 +1,5 @@
1
1
  import type { Fn, Predicate2 } from "@thi.ng/api";
2
- import type { Transducer } from "../api";
2
+ import type { Transducer } from "./api";
3
3
  export interface FilterFuzzyOpts<A, B> {
4
4
  /**
5
5
  * Key extractor function.
@@ -1,8 +1,8 @@
1
- import { fuzzyMatch } from "@thi.ng/arrays";
2
- import { $iter } from "../iterator";
1
+ import { fuzzyMatch } from "@thi.ng/arrays/fuzzy-match";
2
+ import { __iter } from "./iterator";
3
3
  import { filter } from "./filter";
4
4
  export function filterFuzzy(...args) {
5
- const iter = args.length > 1 && $iter(filterFuzzy, args);
5
+ const iter = args.length > 1 && __iter(filterFuzzy, args);
6
6
  if (iter) {
7
7
  return iter;
8
8
  }
@@ -1,5 +1,5 @@
1
1
  import type { Predicate } from "@thi.ng/api";
2
- import type { Transducer } from "../api";
2
+ import type { Transducer } from "./api";
3
3
  export declare function filter<T>(pred: Predicate<T>): Transducer<T, T>;
4
4
  export declare function filter<T>(pred: Predicate<T>, src: Iterable<T>): IterableIterator<T>;
5
5
  //# sourceMappingURL=filter.d.ts.map
@@ -1,6 +1,6 @@
1
- import { isIterable } from "@thi.ng/checks";
2
- import { compR } from "../func/compr";
3
- import { iterator1 } from "../iterator";
1
+ import { isIterable } from "@thi.ng/checks/is-iterable";
2
+ import { compR } from "./compr";
3
+ import { iterator1 } from "./iterator";
4
4
  export function filter(pred, src) {
5
5
  return isIterable(src)
6
6
  ? iterator1(filter(pred), src)
@@ -1,5 +1,5 @@
1
- import type { Fn, Nullable } from "@thi.ng/api";
2
- import type { Transducer } from "../api";
1
+ import type { DeepArrayValue, Fn, Nullable } from "@thi.ng/api";
2
+ import type { Transducer } from "./api";
3
3
  declare type MaybeIterable<T> = Nullable<Iterable<T>>;
4
4
  /**
5
5
  * Transducer. Takes a function `fn` which will be applied to each input
@@ -30,7 +30,7 @@ declare type MaybeIterable<T> = Nullable<Iterable<T>>;
30
30
  * @param fn -
31
31
  * @param src -
32
32
  */
33
- export declare function flattenWith<T>(fn: Fn<T, MaybeIterable<T>>): Transducer<T | Iterable<T>, T>;
34
- export declare function flattenWith<T>(fn: Fn<T, MaybeIterable<T>>, src: Iterable<T | Iterable<T>>): IterableIterator<T>;
33
+ export declare function flattenWith<A, B = DeepArrayValue<A>>(fn: Fn<any, MaybeIterable<any>>): Transducer<A, B>;
34
+ export declare function flattenWith<A, B = DeepArrayValue<A>>(fn: Fn<any, MaybeIterable<any>>, src: Iterable<A>): IterableIterator<B>;
35
35
  export {};
36
36
  //# sourceMappingURL=flatten-with.d.ts.map
@@ -1,7 +1,8 @@
1
- import { isIterable, isString } from "@thi.ng/checks";
2
- import { compR } from "../func/compr";
3
- import { iterator } from "../iterator";
4
- import { isReduced } from "../reduced";
1
+ import { isIterable } from "@thi.ng/checks/is-iterable";
2
+ import { isString } from "@thi.ng/checks/is-string";
3
+ import { compR } from "./compr";
4
+ import { iterator } from "./iterator";
5
+ import { isReduced } from "./reduced";
5
6
  export function flattenWith(fn, src) {
6
7
  return isIterable(src)
7
8
  ? iterator(flattenWith(fn), isString(src) ? [src] : src)
@@ -1,4 +1,5 @@
1
- import type { Transducer } from "../api";
1
+ import type { DeepArrayValue } from "@thi.ng/api";
2
+ import type { Transducer } from "./api";
2
3
  /**
3
4
  * Transducer. Recursively flattens input iff it is iterable and NOT a
4
5
  * string.
@@ -18,6 +19,6 @@ import type { Transducer } from "../api";
18
19
  *
19
20
  * @param src -
20
21
  */
21
- export declare function flatten<T>(): Transducer<T | Iterable<T>, T>;
22
- export declare function flatten<T>(src: Iterable<T | Iterable<T>>): IterableIterator<T>;
22
+ export declare function flatten<A, B = DeepArrayValue<A>>(): Transducer<A, B>;
23
+ export declare function flatten<A, B = DeepArrayValue<A>>(src: Iterable<A>): IterableIterator<B>;
23
24
  //# sourceMappingURL=flatten.d.ts.map
@@ -1,4 +1,4 @@
1
- import { isNotStringAndIterable } from "@thi.ng/checks";
1
+ import { isNotStringAndIterable } from "@thi.ng/checks/is-not-string-iterable";
2
2
  import { flattenWith } from "./flatten-with";
3
3
  export function flatten(src) {
4
4
  return flattenWith((x) => (isNotStringAndIterable(x) ? x : undefined), src);
@@ -1,5 +1,5 @@
1
1
  import type { Fn } from "@thi.ng/api";
2
- import type { Reducer } from "../api";
2
+ import type { Reducer } from "./api";
3
3
  export declare function frequencies<A>(): Reducer<Map<A, number>, A>;
4
4
  export declare function frequencies<A>(xs: Iterable<A>): Map<A, number>;
5
5
  export declare function frequencies<A, B>(key: Fn<A, B>): Reducer<Map<B, number>, A>;