@apitree.cz/ts-utils 0.1.5 → 0.1.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apitree.cz/ts-utils",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "TypeScript utility functions for ApiTree projects.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,12 +17,13 @@
17
17
  },
18
18
  "types": "./dist/index.d.ts",
19
19
  "files": [
20
- "dist"
20
+ "dist",
21
+ "src"
21
22
  ],
22
23
  "devDependencies": {
23
24
  "typedoc": "^0.27.6",
24
25
  "typescript": "^5.7.3",
25
- "@apitree.cz/typedoc-config": "0.1.7"
26
+ "@apitree.cz/typedoc-config": "0.1.8"
26
27
  },
27
28
  "scripts": {
28
29
  "prebuild": "del dist tsconfig.build.tsbuildinfo",
package/src/equals.ts ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Strictly check if two values are equal.
3
+ */
4
+ export const equals = (a: unknown, b: unknown) => a === b;
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './equals.js';
2
+ export * from './is-nil.js';
3
+ export * from './not-nil.js';
package/src/is-nil.ts ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Checks if value IS `null` or `undefined`. Works as a type guard.
3
+ */
4
+ export const isNil = (value: unknown): value is null | undefined => value == null;
package/src/not-nil.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { isNil } from './is-nil.js';
2
+
3
+ /**
4
+ * Checks if value IS NOT `null` or `undefined`. Works as a type guard.
5
+ */
6
+ export const notNil = <T>(type: T): type is NonNullable<T> => !isNil(type);