@tb-dev/utils 1.1.5 → 1.2.1

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
@@ -1,5 +1,5 @@
1
1
  # @tb-dev/utils
2
2
 
3
3
  ```bash
4
- pnpm add -D @tb-dev/utils
5
- ```
4
+ pnpm add @tb-dev/utils
5
+ ```
package/dist/index.cjs CHANGED
@@ -24,7 +24,10 @@ function isEmpty(value) {
24
24
  if (value instanceof Map || value instanceof Set) {
25
25
  return value.size === 0;
26
26
  }
27
- return true;
27
+ return isNullish(value);
28
+ }
29
+ function isNullish(value) {
30
+ return value === null || value === void 0;
28
31
  }
29
32
  function repeat(amount, fn) {
30
33
  let n = Math.trunc(amount);
@@ -43,6 +46,7 @@ function toPixel(value) {
43
46
  return `${value}px`;
44
47
  }
45
48
  exports.isEmpty = isEmpty;
49
+ exports.isNullish = isNullish;
46
50
  exports.repeat = repeat;
47
51
  exports.splitWhitespace = splitWhitespace;
48
52
  exports.toArray = toArray;
package/dist/index.d.ts CHANGED
@@ -5,10 +5,18 @@ export declare function isEmpty(value?: Nullish<string>): boolean;
5
5
 
6
6
  export declare function isEmpty<T>(value?: Nullish<T[]>): boolean;
7
7
 
8
+ export declare function isEmpty<T>(value?: Nullish<readonly T[]>): boolean;
9
+
8
10
  export declare function isEmpty<K>(value?: Nullish<Set<K>>): boolean;
9
11
 
12
+ export declare function isEmpty<K>(value?: Nullish<ReadonlySet<K>>): boolean;
13
+
10
14
  export declare function isEmpty<K, V>(value?: Nullish<Map<K, V>>): boolean;
11
15
 
16
+ export declare function isEmpty<K, V>(value?: Nullish<ReadonlyMap<K, V>>): boolean;
17
+
18
+ export declare function isNullish(value: unknown): boolean;
19
+
12
20
  export declare function repeat(amount: number, fn: (current: number) => void): void;
13
21
 
14
22
  export declare function splitWhitespace(value: Nullish<string | string[]>): string[];
package/dist/index.js CHANGED
@@ -22,7 +22,10 @@ function isEmpty(value) {
22
22
  if (value instanceof Map || value instanceof Set) {
23
23
  return value.size === 0;
24
24
  }
25
- return true;
25
+ return isNullish(value);
26
+ }
27
+ function isNullish(value) {
28
+ return value === null || value === void 0;
26
29
  }
27
30
  function repeat(amount, fn) {
28
31
  let n = Math.trunc(amount);
@@ -42,6 +45,7 @@ function toPixel(value) {
42
45
  }
43
46
  export {
44
47
  isEmpty,
48
+ isNullish,
45
49
  repeat,
46
50
  splitWhitespace,
47
51
  toArray,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tb-dev/utils",
3
- "version": "1.1.5",
3
+ "version": "1.2.1",
4
4
  "description": "TypeScript utils",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -28,10 +28,10 @@
28
28
  "*.{?(c|m)@(j|t)s,vue}": "pnpm run lint"
29
29
  },
30
30
  "dependencies": {
31
- "@tb-dev/utility-types": "^1.0.10"
31
+ "@tb-dev/utility-types": "^1.1.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@tb-dev/eslint-config": "^1.6.2",
34
+ "@tb-dev/eslint-config": "^1.6.5",
35
35
  "@types/node": "^20.11.5",
36
36
  "eslint": "^8.56.0",
37
37
  "husky": "^8.0.3",
@@ -42,7 +42,7 @@
42
42
  "typedoc": "^0.25.7",
43
43
  "typedoc-plugin-mdn-links": "^3.1.12",
44
44
  "typescript": "5.3.3",
45
- "vite": "^5.0.11",
45
+ "vite": "^5.0.12",
46
46
  "vite-plugin-dts": "^3.7.1"
47
47
  },
48
48
  "files": [