@elyukai/utils 0.3.0 → 0.3.2

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
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [0.3.2](https://github.com/elyukai/ts-utils/compare/v0.3.1...v0.3.2) (2026-03-13)
6
+
7
+
8
+ ### Features
9
+
10
+ * add debugging helpers ([a06fab4](https://github.com/elyukai/ts-utils/commit/a06fab4b63db49777968a9755ffb6958b743e305))
11
+
12
+ ## [0.3.1](https://github.com/elyukai/ts-utils/compare/v0.3.0...v0.3.1) (2026-03-13)
13
+
14
+
15
+ ### Features
16
+
17
+ * groupBy only produces non-empty arrays ([dce9118](https://github.com/elyukai/ts-utils/commit/dce91185c63da77a58d7b48beb15c98945491eb3))
18
+
5
19
  ## [0.3.0](https://github.com/elyukai/ts-utils/compare/v0.2.9...v0.3.0) (2026-03-06)
6
20
 
7
21
 
@@ -3,6 +3,7 @@
3
3
  * @module
4
4
  */
5
5
  import type { Equality } from "../equality.ts";
6
+ import type { NonEmptyArray } from "./nonEmpty.ts";
6
7
  /**
7
8
  * Partitions an array into two arrays based on a predicate.
8
9
  * @param arr The array to split.
@@ -18,7 +19,7 @@ export declare function partition<T>(arr: T[], predicate: (value: T) => boolean)
18
19
  * given equality function are grouped together. Calling the `flat` method on
19
20
  * the result will return the original array.
20
21
  */
21
- export declare const groupBy: <T>(arr: T[], equal: Equality<T>) => T[][];
22
+ export declare const groupBy: <T>(arr: T[], equal: Equality<T>) => NonEmptyArray<T>[];
22
23
  /**
23
24
  * Splits an array into chunks of a specified size.
24
25
  * @param arr The array to be chunked.
@@ -0,0 +1,16 @@
1
+ /**
2
+ *´Utility function for debugging purposes.
3
+ * @module
4
+ */
5
+ /**
6
+ * Logs a message to the console and returns the provided value.
7
+ */
8
+ export declare const trace: <T>(value: T, message: unknown) => T;
9
+ /**
10
+ * Logs a value and returns it afterwards.
11
+ */
12
+ export declare const traceId: <T>(value: T) => T;
13
+ /**
14
+ * Logs the result of applying a function to a value and returns the value.
15
+ */
16
+ export declare const traceWith: <T>(value: T, fn: (value: T) => unknown) => T;
@@ -0,0 +1,25 @@
1
+ /**
2
+ *´Utility function for debugging purposes.
3
+ * @module
4
+ */
5
+ /**
6
+ * Logs a message to the console and returns the provided value.
7
+ */
8
+ export const trace = (value, message) => {
9
+ console.log(message);
10
+ return value;
11
+ };
12
+ /**
13
+ * Logs a value and returns it afterwards.
14
+ */
15
+ export const traceId = (value) => {
16
+ console.log(value);
17
+ return value;
18
+ };
19
+ /**
20
+ * Logs the result of applying a function to a value and returns the value.
21
+ */
22
+ export const traceWith = (value, fn) => {
23
+ console.log(fn(value));
24
+ return value;
25
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyukai/utils",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "A set of JavaScript helper functions.",
5
5
  "files": [
6
6
  "dist",