@darthcav/ts-utils 0.8.1 → 0.8.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/README.md CHANGED
@@ -77,6 +77,18 @@ millisecondsToString(90_000) // "1m 30s"
77
77
  millisecondsToString(5_000) // "5s"
78
78
  ```
79
79
 
80
+ ### `noop`
81
+
82
+ A no-op function that does nothing and returns `void`. Useful as a placeholder
83
+ callback or default handler.
84
+
85
+ ```ts
86
+ import { noop } from "@darthcav/ts-utils"
87
+
88
+ setTimeout(noop, 1000)
89
+ element.addEventListener("click", noop)
90
+ ```
91
+
80
92
  ### `getDummyLogger`
81
93
 
82
94
  Returns a no-op `Logger` useful as a placeholder in tests. All logging methods
@@ -150,6 +162,7 @@ npm run doc
150
162
  src/
151
163
  index.ts # Public API entry point
152
164
  main.ts # Main module
165
+ noop.ts # No-op function
153
166
  loggers/ # Logger utilities
154
167
  __tests__/ # Test files
155
168
  dist/ # Compiled output (generated)
@@ -161,7 +174,7 @@ public/ # Documentation output (generated)
161
174
  [Apache-2.0](LICENSE)
162
175
 
163
176
  [node-version]: https://img.shields.io/badge/node-%3E%3D25-orange.svg?style=flat-square
164
- [version-image]: https://img.shields.io/badge/version-0.8.1-blue.svg?style=flat-square
177
+ [version-image]: https://img.shields.io/badge/version-0.8.2-blue.svg?style=flat-square
165
178
  [ci-badge]: https://github.com/darthcav/ts-utils/actions/workflows/tests.yml/badge.svg
166
179
  [coverage-badge]: https://img.shields.io/badge/coverage-check%20CI-yellow.svg?style=flat-square
167
180
  [pages-url]: https://darthcav.github.io/ts-utils/
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=noop.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noop.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/noop.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import assert from "node:assert/strict";
2
+ import { suite, test } from "node:test";
3
+ import noop from "../noop.js";
4
+ await suite("noop", () => {
5
+ test("returns undefined", () => {
6
+ assert.equal(noop(), undefined);
7
+ });
8
+ test("is a function", () => {
9
+ assert.equal(typeof noop, "function");
10
+ });
11
+ });
12
+ //# sourceMappingURL=noop.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noop.test.js","sourceRoot":"","sources":["../../src/__tests__/noop.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,IAAI,MAAM,YAAY,CAAA;AAE7B,MAAM,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE;IACrB,IAAI,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC3B,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,SAAS,CAAC,CAAA;IACnC,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE;QACvB,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,UAAU,CAAC,CAAA;IACzC,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
package/dist/index.d.ts CHANGED
@@ -8,5 +8,6 @@ import getDummyLogger from "./loggers/getDummyLogger.ts";
8
8
  import { type LauncherFunction, main } from "./main.ts";
9
9
  import millisecondsToString from "./millisecondsToString.ts";
10
10
  import monitorMemory from "./monitorMemory.ts";
11
- export { getConsoleLogger, getDummyLogger, type LauncherFunction, main, millisecondsToString, monitorMemory, };
11
+ import noop from "./noop.ts";
12
+ export { getConsoleLogger, getDummyLogger, type LauncherFunction, main, millisecondsToString, monitorMemory, noop, };
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,gBAAgB,MAAM,+BAA+B,CAAA;AAC5D,OAAO,cAAc,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,KAAK,gBAAgB,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACvD,OAAO,oBAAoB,MAAM,2BAA2B,CAAA;AAC5D,OAAO,aAAa,MAAM,oBAAoB,CAAA;AAE9C,OAAO,EACH,gBAAgB,EAChB,cAAc,EACd,KAAK,gBAAgB,EACrB,IAAI,EACJ,oBAAoB,EACpB,aAAa,GAChB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,gBAAgB,MAAM,+BAA+B,CAAA;AAC5D,OAAO,cAAc,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,KAAK,gBAAgB,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACvD,OAAO,oBAAoB,MAAM,2BAA2B,CAAA;AAC5D,OAAO,aAAa,MAAM,oBAAoB,CAAA;AAC9C,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EACH,gBAAgB,EAChB,cAAc,EACd,KAAK,gBAAgB,EACrB,IAAI,EACJ,oBAAoB,EACpB,aAAa,EACb,IAAI,GACP,CAAA"}
package/dist/index.js CHANGED
@@ -8,5 +8,6 @@ import getDummyLogger from "./loggers/getDummyLogger.js";
8
8
  import { main } from "./main.js";
9
9
  import millisecondsToString from "./millisecondsToString.js";
10
10
  import monitorMemory from "./monitorMemory.js";
11
- export { getConsoleLogger, getDummyLogger, main, millisecondsToString, monitorMemory, };
11
+ import noop from "./noop.js";
12
+ export { getConsoleLogger, getDummyLogger, main, millisecondsToString, monitorMemory, noop, };
12
13
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,gBAAgB,MAAM,+BAA+B,CAAA;AAC5D,OAAO,cAAc,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAyB,IAAI,EAAE,MAAM,WAAW,CAAA;AACvD,OAAO,oBAAoB,MAAM,2BAA2B,CAAA;AAC5D,OAAO,aAAa,MAAM,oBAAoB,CAAA;AAE9C,OAAO,EACH,gBAAgB,EAChB,cAAc,EAEd,IAAI,EACJ,oBAAoB,EACpB,aAAa,GAChB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,gBAAgB,MAAM,+BAA+B,CAAA;AAC5D,OAAO,cAAc,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAyB,IAAI,EAAE,MAAM,WAAW,CAAA;AACvD,OAAO,oBAAoB,MAAM,2BAA2B,CAAA;AAC5D,OAAO,aAAa,MAAM,oBAAoB,CAAA;AAC9C,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EACH,gBAAgB,EAChB,cAAc,EAEd,IAAI,EACJ,oBAAoB,EACpB,aAAa,EACb,IAAI,GACP,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"getDummyLogger.d.ts","sourceRoot":"","sources":["../../src/loggers/getDummyLogger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAuB,MAAM,kBAAkB,CAAA;AAInE;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,IAAI,MAAM,CAiB/C"}
1
+ {"version":3,"file":"getDummyLogger.d.ts","sourceRoot":"","sources":["../../src/loggers/getDummyLogger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAuB,MAAM,kBAAkB,CAAA;AAGnE;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,IAAI,MAAM,CAiB/C"}
@@ -1,4 +1,4 @@
1
- const noop = () => { };
1
+ import noop from "../noop.js";
2
2
  /**
3
3
  * Returns a no-op {@link Logger} useful as a placeholder in tests.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"getDummyLogger.js","sourceRoot":"","sources":["../../src/loggers/getDummyLogger.ts"],"names":[],"mappings":"AAEA,MAAM,IAAI,GAAG,GAAS,EAAE,GAAE,CAAC,CAAA;AAE3B;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc;IAClC,MAAM,MAAM,GAAW;QACnB,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,IAAkC;QACzC,KAAK,EAAE,IAAkC;QACzC,IAAI,EAAE,IAAiC;QACvC,IAAI,EAAE,IAAiC;QACvC,OAAO,EAAE,IAAoC;QAC7C,KAAK,EAAE,IAAkC;QACzC,KAAK,EAAE,IAAkC;QACzC,IAAI,EAAE,CAAC,OAAoC,EAAQ,EAAE,GAAE,CAAC;QACxD,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM;QACtB,YAAY,EAAE,CAAC,MAAgB,EAAW,EAAE,CAAC,KAAK;QAClD,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM;KACrB,CAAA;IACD,OAAO,MAAM,CAAA;AACjB,CAAC"}
1
+ {"version":3,"file":"getDummyLogger.js","sourceRoot":"","sources":["../../src/loggers/getDummyLogger.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,YAAY,CAAA;AAE7B;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc;IAClC,MAAM,MAAM,GAAW;QACnB,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,IAAkC;QACzC,KAAK,EAAE,IAAkC;QACzC,IAAI,EAAE,IAAiC;QACvC,IAAI,EAAE,IAAiC;QACvC,OAAO,EAAE,IAAoC;QAC7C,KAAK,EAAE,IAAkC;QACzC,KAAK,EAAE,IAAkC;QACzC,IAAI,EAAE,CAAC,OAAoC,EAAQ,EAAE,GAAE,CAAC;QACxD,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM;QACtB,YAAY,EAAE,CAAC,MAAgB,EAAW,EAAE,CAAC,KAAK;QAClD,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM;KACrB,CAAA;IACD,OAAO,MAAM,CAAA;AACjB,CAAC"}
package/dist/noop.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A no-op function that does nothing and returns `void`.
3
+ *
4
+ * Useful as a placeholder callback, default handler, or in tests.
5
+ */
6
+ declare const noop: () => void;
7
+ export default noop;
8
+ //# sourceMappingURL=noop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noop.d.ts","sourceRoot":"","sources":["../src/noop.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,QAAA,MAAM,IAAI,QAAO,IAAU,CAAA;AAE3B,eAAe,IAAI,CAAA"}
package/dist/noop.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A no-op function that does nothing and returns `void`.
3
+ *
4
+ * Useful as a placeholder callback, default handler, or in tests.
5
+ */
6
+ const noop = () => { };
7
+ export default noop;
8
+ //# sourceMappingURL=noop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noop.js","sourceRoot":"","sources":["../src/noop.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,IAAI,GAAG,GAAS,EAAE,GAAE,CAAC,CAAA;AAE3B,eAAe,IAAI,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@darthcav/ts-utils",
3
3
  "description": "A collection of utility functions for TypeScript applications and modules",
4
- "version": "0.8.1",
4
+ "version": "0.8.2",
5
5
  "author": {
6
6
  "name": "darthcav"
7
7
  },
@@ -0,0 +1,13 @@
1
+ import assert from "node:assert/strict"
2
+ import { suite, test } from "node:test"
3
+ import noop from "../noop.ts"
4
+
5
+ await suite("noop", () => {
6
+ test("returns undefined", () => {
7
+ assert.equal(noop(), undefined)
8
+ })
9
+
10
+ test("is a function", () => {
11
+ assert.equal(typeof noop, "function")
12
+ })
13
+ })
package/src/index.ts CHANGED
@@ -9,6 +9,7 @@ import getDummyLogger from "./loggers/getDummyLogger.ts"
9
9
  import { type LauncherFunction, main } from "./main.ts"
10
10
  import millisecondsToString from "./millisecondsToString.ts"
11
11
  import monitorMemory from "./monitorMemory.ts"
12
+ import noop from "./noop.ts"
12
13
 
13
14
  export {
14
15
  getConsoleLogger,
@@ -17,4 +18,5 @@ export {
17
18
  main,
18
19
  millisecondsToString,
19
20
  monitorMemory,
21
+ noop,
20
22
  }
@@ -1,6 +1,5 @@
1
1
  import type { Logger, LogLevel, LogRecord } from "@logtape/logtape"
2
-
3
- const noop = (): void => {}
2
+ import noop from "../noop.ts"
4
3
 
5
4
  /**
6
5
  * Returns a no-op {@link Logger} useful as a placeholder in tests.
package/src/noop.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A no-op function that does nothing and returns `void`.
3
+ *
4
+ * Useful as a placeholder callback, default handler, or in tests.
5
+ */
6
+ const noop = (): void => {}
7
+
8
+ export default noop