@thi.ng/transducers 8.3.37 → 8.4.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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2023-03-09T13:01:59Z
3
+ - **Last updated**: 2023-03-19T14:07:45Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -9,6 +9,13 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
9
9
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
10
  and/or version bumps of transitive dependencies.
11
11
 
12
+ ## [8.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/transducers@8.4.0) (2023-03-19)
13
+
14
+ #### 🚀 Features
15
+
16
+ - add flatten1() transducer ([2ffd476](https://github.com/thi-ng/umbrella/commit/2ffd476))
17
+ - syntax sugar for a common mapcat() usecase
18
+
12
19
  ## [8.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/transducers@8.3.0) (2022-03-11)
13
20
 
14
21
  #### 🚀 Features
package/README.md CHANGED
@@ -872,6 +872,7 @@ transduce(map((x) => x*10), push(), range(4))
872
872
  - [filter](https://github.com/thi-ng/umbrella/tree/develop/packages/transducers/src/filter.ts)
873
873
  - [flattenWith](https://github.com/thi-ng/umbrella/tree/develop/packages/transducers/src/flatten-with.ts)
874
874
  - [flatten](https://github.com/thi-ng/umbrella/tree/develop/packages/transducers/src/flatten.ts)
875
+ - [flatten1](https://github.com/thi-ng/umbrella/tree/develop/packages/transducers/src/flatten1.ts)
875
876
  - [indexed](https://github.com/thi-ng/umbrella/tree/develop/packages/transducers/src/indexed.ts)
876
877
  - [interleave](https://github.com/thi-ng/umbrella/tree/develop/packages/transducers/src/interleave.ts)
877
878
  - [interpolate](https://github.com/thi-ng/umbrella/tree/develop/packages/transducers/src/interpolate.ts)
package/flatten1.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ import type { Transducer } from "./api.js";
2
+ /**
3
+ * Transducer. Syntax sugar for `mapcat(x => x, ...)`, aka flattens/dissolves
4
+ * 1st level of nesting in input. See {@link mapcat}.
5
+ *
6
+ * @example
7
+ * ```
8
+ * [...flatten1([[1], [2, 2], [3, 3, 3]])]
9
+ * // [ 1, 2, 2, 3, 3, 3 ]
10
+ *
11
+ * // same as:
12
+ * [...mapcat((x) => x, [[1], [2, 2], [3, 3, 3]])]
13
+ * // [ 1, 2, 2, 3, 3, 3 ]
14
+ * ```
15
+ *
16
+ * @param src
17
+ */
18
+ export declare function flatten1<T>(): Transducer<Iterable<T>, T>;
19
+ export declare function flatten1<T>(src: Iterable<Iterable<T>>): IterableIterator<T>;
20
+ //# sourceMappingURL=flatten1.d.ts.map
package/flatten1.js ADDED
@@ -0,0 +1,4 @@
1
+ import { mapcat } from "./mapcat.js";
2
+ export function flatten1(src) {
3
+ return mapcat((x) => x, src);
4
+ }
package/index.d.ts CHANGED
@@ -61,6 +61,7 @@ export * from "./filter.js";
61
61
  export * from "./filter-fuzzy.js";
62
62
  export * from "./flatten-with.js";
63
63
  export * from "./flatten.js";
64
+ export * from "./flatten1.js";
64
65
  export * from "./indexed.js";
65
66
  export * from "./interleave.js";
66
67
  export * from "./interpolate.js";
package/index.js CHANGED
@@ -64,6 +64,7 @@ export * from "./filter.js";
64
64
  export * from "./filter-fuzzy.js";
65
65
  export * from "./flatten-with.js";
66
66
  export * from "./flatten.js";
67
+ export * from "./flatten1.js";
67
68
  export * from "./indexed.js";
68
69
  export * from "./interleave.js";
69
70
  export * from "./interpolate.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/transducers",
3
- "version": "8.3.37",
3
+ "version": "8.4.0",
4
4
  "description": "Lightweight transducer implementations for ES6 / TypeScript",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -29,7 +29,7 @@
29
29
  "license": "Apache-2.0",
30
30
  "scripts": {
31
31
  "build": "yarn clean && tsc --declaration",
32
- "clean": "rimraf '*.js' '*.d.ts' '*.map' doc internal",
32
+ "clean": "rimraf --glob '*.js' '*.d.ts' '*.map' doc internal",
33
33
  "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
34
34
  "doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
35
35
  "doc:readme": "yarn doc:stats && tools:readme",
@@ -38,21 +38,21 @@
38
38
  "test": "testament test"
39
39
  },
40
40
  "dependencies": {
41
- "@thi.ng/api": "^8.7.3",
42
- "@thi.ng/arrays": "^2.5.7",
43
- "@thi.ng/checks": "^3.3.9",
44
- "@thi.ng/compare": "^2.1.26",
45
- "@thi.ng/compose": "^2.1.28",
46
- "@thi.ng/errors": "^2.2.12",
47
- "@thi.ng/math": "^5.4.4",
48
- "@thi.ng/random": "^3.3.26"
41
+ "@thi.ng/api": "^8.7.4",
42
+ "@thi.ng/arrays": "^2.5.8",
43
+ "@thi.ng/checks": "^3.3.10",
44
+ "@thi.ng/compare": "^2.1.27",
45
+ "@thi.ng/compose": "^2.1.29",
46
+ "@thi.ng/errors": "^2.2.13",
47
+ "@thi.ng/math": "^5.4.5",
48
+ "@thi.ng/random": "^3.3.27"
49
49
  },
50
50
  "devDependencies": {
51
- "@microsoft/api-extractor": "^7.34.2",
52
- "@thi.ng/testament": "^0.3.12",
53
- "rimraf": "^4.1.2",
51
+ "@microsoft/api-extractor": "^7.34.4",
52
+ "@thi.ng/testament": "^0.3.13",
53
+ "rimraf": "^4.4.0",
54
54
  "tools": "^0.0.1",
55
- "typedoc": "^0.23.24",
55
+ "typedoc": "^0.23.26",
56
56
  "typescript": "^4.9.5"
57
57
  },
58
58
  "keywords": [
@@ -214,6 +214,9 @@
214
214
  "./flatten": {
215
215
  "default": "./flatten.js"
216
216
  },
217
+ "./flatten1": {
218
+ "default": "./flatten1.js"
219
+ },
217
220
  "./frequencies": {
218
221
  "default": "./frequencies.js"
219
222
  },
@@ -571,5 +574,5 @@
571
574
  ],
572
575
  "year": 2016
573
576
  },
574
- "gitHead": "8ab2cbfe2f59b7ef672b6e1cf2a43368f8437ddf\n"
577
+ "gitHead": "1359645f3af8a7d0d43fe7944ea5cd865832f8ee\n"
575
578
  }