@nativerent/js-utils 1.0.4 → 1.0.5

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.
Files changed (2) hide show
  1. package/package.json +6 -3
  2. package/src/index.ts +21 -21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativerent/js-utils",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -15,12 +15,15 @@
15
15
  "@types/jest": "^29.5.11",
16
16
  "eslint": "^8.56.0",
17
17
  "jest": "^29.7.0",
18
+ "jest-environment-jsdom": "^29.7.0",
18
19
  "prettier": "^3.1.1",
19
20
  "rollup": "^4.9.4",
20
21
  "rollup-plugin-dts": "^6.1.0",
21
22
  "rollup-plugin-esbuild": "^6.1.0",
22
23
  "ts-jest": "^29.1.1",
23
- "typescript": "^5.3.3",
24
- "jest-environment-jsdom": "^29.7.0"
24
+ "typescript": "^5.3.3"
25
+ },
26
+ "dependencies": {
27
+ "@nativerent/js-utils": "^1.0.4"
25
28
  }
26
29
  }
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { FlattenableObject, Primitive, SimpleObject } from "./types";
1
+ import type { FlattenableObject, Primitive, SimpleObject } from "./types";
2
2
 
3
3
  export function debounce(fn: Function, delay: number): () => void {
4
4
  let timeout: ReturnType<typeof setTimeout>;
@@ -22,51 +22,51 @@ export function throttle(fn: Function, delay: number) {
22
22
  };
23
23
  }
24
24
 
25
- export function isObject(obj: any): obj is object {
26
- return !!obj && typeof obj === "object" && !Array.isArray(obj);
25
+ export function isObject(value: any): value is object {
26
+ return !!value && typeof value === "object" && !Array.isArray(value);
27
27
  }
28
28
 
29
- export function isFn(fn: any): fn is Function {
30
- return typeof fn === "function";
29
+ export function isFn(value: any): value is Function {
30
+ return typeof value === "function";
31
31
  }
32
32
 
33
- export function isStr(str: any): boolean {
34
- return typeof str === "string";
33
+ export function isStr(value: any): boolean {
34
+ return typeof value === "string";
35
35
  }
36
36
 
37
- export function isString(str: any): str is string {
38
- return typeof str === "string";
37
+ export function isString(value: any): value is string {
38
+ return typeof value === "string";
39
39
  }
40
40
 
41
41
  /**
42
42
  * Check if the given argument is a string which is not empty
43
43
  */
44
- export function isNotEmptyString(str: any) {
45
- return typeof str === "string" && str.length;
44
+ export function isNotEmptyString(value: any) {
45
+ return isString(value) && value.length;
46
46
  }
47
47
 
48
- export function isHTMLElement(el: any): el is HTMLElement {
49
- return el instanceof HTMLElement || el instanceof SVGElement;
48
+ export function isHTMLElement(value: any): value is HTMLElement {
49
+ return value instanceof HTMLElement || value instanceof SVGElement;
50
50
  }
51
51
 
52
- export function isNum(num: any): num is number {
53
- return typeof num === "number";
52
+ export function isNum(value: any): value is number {
53
+ return typeof value === "number";
54
54
  }
55
55
 
56
- export function isBool(bool: any): boolean {
57
- return typeof bool === "boolean";
56
+ export function isBool(value: any): value is boolean {
57
+ return typeof value === "boolean";
58
58
  }
59
59
 
60
- export function isUndef(val: any): val is undefined {
61
- return typeof val === "undefined";
60
+ export function isUndef(value: any): value is undefined {
61
+ return typeof value === "undefined";
62
62
  }
63
63
 
64
64
  export function isNullOrUndef(value: unknown): value is null | undefined {
65
65
  return value === null || typeof value === "undefined";
66
66
  }
67
67
 
68
- export function isDefined(val: any): boolean {
69
- return !isUndef(val);
68
+ export function isDefined(value: any): boolean {
69
+ return !isUndef(value);
70
70
  }
71
71
 
72
72
  /**