is-where 2.0.1 → 2.0.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/dist/index.d.ts +11 -18
- package/dist/index.js +12 -19
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,32 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Returns `true` if the current environment supports touch events
|
|
3
|
+
*
|
|
3
4
|
* @see https://stackoverflow.com/a/63666289/2697506
|
|
4
5
|
*/
|
|
5
6
|
export declare function isTouchSupported(): boolean;
|
|
6
|
-
/**
|
|
7
|
-
* returns `true` if the current environment is Node
|
|
8
|
-
*/
|
|
7
|
+
/** Returns `true` if the current environment is Node */
|
|
9
8
|
export declare function isNode(): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* returns `true` if the current environment is a browser
|
|
12
|
-
*/
|
|
9
|
+
/** Returns `true` if the current environment is a browser */
|
|
13
10
|
export declare function isBrowser(): boolean;
|
|
14
|
-
/**
|
|
15
|
-
* returns `true` if the current environment is a Web Worker
|
|
16
|
-
*/
|
|
11
|
+
/** Returns `true` if the current environment is a Web Worker */
|
|
17
12
|
export declare function isWebWorker(): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* returns `true` if the current environment is JS DOM
|
|
20
|
-
*/
|
|
13
|
+
/** Returns `true` if the current environment is JS DOM */
|
|
21
14
|
export declare function isJsDom(): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* returns `true` if the current environment is Deno
|
|
24
|
-
*/
|
|
15
|
+
/** Returns `true` if the current environment is Deno */
|
|
25
16
|
export declare function isDeno(): boolean;
|
|
26
17
|
/**
|
|
27
|
-
*
|
|
18
|
+
* Returns `true` if the current browser is based on WebKit
|
|
28
19
|
*
|
|
29
20
|
* This includes:
|
|
21
|
+
*
|
|
30
22
|
* - Safari on macOS
|
|
31
23
|
* - Safari on iOS & iPadOS
|
|
32
24
|
* - Google Chrome on iOS & iPadOS
|
|
@@ -37,9 +29,10 @@ export declare function isDeno(): boolean;
|
|
|
37
29
|
*/
|
|
38
30
|
export declare function isWebKit(): boolean;
|
|
39
31
|
/**
|
|
40
|
-
*
|
|
32
|
+
* Returns `true` if the current browser is Safari
|
|
41
33
|
*
|
|
42
34
|
* This includes:
|
|
35
|
+
*
|
|
43
36
|
* - Safari on macOS
|
|
44
37
|
* - Safari on iOS & iPadOS
|
|
45
38
|
*
|
package/dist/index.js
CHANGED
|
@@ -1,49 +1,41 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Returns `true` if the current environment supports touch events
|
|
3
|
+
*
|
|
3
4
|
* @see https://stackoverflow.com/a/63666289/2697506
|
|
4
5
|
*/
|
|
5
6
|
export function isTouchSupported() {
|
|
6
|
-
return isBrowser() && matchMedia('(hover: none)').matches;
|
|
7
|
+
return isBrowser() && window.matchMedia('(hover: none)').matches;
|
|
7
8
|
}
|
|
8
|
-
/**
|
|
9
|
-
* returns `true` if the current environment is Node
|
|
10
|
-
*/
|
|
9
|
+
/** Returns `true` if the current environment is Node */
|
|
11
10
|
export function isNode() {
|
|
12
11
|
return typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
|
|
13
12
|
}
|
|
14
|
-
/**
|
|
15
|
-
* returns `true` if the current environment is a browser
|
|
16
|
-
*/
|
|
13
|
+
/** Returns `true` if the current environment is a browser */
|
|
17
14
|
export function isBrowser() {
|
|
18
15
|
return typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
19
16
|
}
|
|
20
|
-
/**
|
|
21
|
-
* returns `true` if the current environment is a Web Worker
|
|
22
|
-
*/
|
|
17
|
+
/** Returns `true` if the current environment is a Web Worker */
|
|
23
18
|
export function isWebWorker() {
|
|
24
19
|
return (typeof self === 'object' &&
|
|
25
20
|
self.constructor &&
|
|
26
21
|
self.constructor.name === 'DedicatedWorkerGlobalScope');
|
|
27
22
|
}
|
|
28
|
-
/**
|
|
29
|
-
* returns `true` if the current environment is JS DOM
|
|
30
|
-
*/
|
|
23
|
+
/** Returns `true` if the current environment is JS DOM */
|
|
31
24
|
export function isJsDom() {
|
|
32
25
|
return ((typeof window !== 'undefined' && window.name === 'nodejs') ||
|
|
33
26
|
(typeof navigator !== 'undefined' &&
|
|
34
27
|
(navigator.userAgent.includes('Node.js') || navigator.userAgent.includes('jsdom'))));
|
|
35
28
|
}
|
|
36
|
-
/**
|
|
37
|
-
* returns `true` if the current environment is Deno
|
|
38
|
-
*/
|
|
29
|
+
/** Returns `true` if the current environment is Deno */
|
|
39
30
|
export function isDeno() {
|
|
40
31
|
// @ts-expect-error Deno types not found
|
|
41
32
|
return typeof Deno !== 'undefined' && typeof Deno.core !== 'undefined';
|
|
42
33
|
}
|
|
43
34
|
/**
|
|
44
|
-
*
|
|
35
|
+
* Returns `true` if the current browser is based on WebKit
|
|
45
36
|
*
|
|
46
37
|
* This includes:
|
|
38
|
+
*
|
|
47
39
|
* - Safari on macOS
|
|
48
40
|
* - Safari on iOS & iPadOS
|
|
49
41
|
* - Google Chrome on iOS & iPadOS
|
|
@@ -59,9 +51,10 @@ export function isWebKit() {
|
|
|
59
51
|
!!navigator.userAgent);
|
|
60
52
|
}
|
|
61
53
|
/**
|
|
62
|
-
*
|
|
54
|
+
* Returns `true` if the current browser is Safari
|
|
63
55
|
*
|
|
64
56
|
* This includes:
|
|
57
|
+
*
|
|
65
58
|
* - Safari on macOS
|
|
66
59
|
* - Safari on iOS & iPadOS
|
|
67
60
|
*
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "is-where",
|
|
3
3
|
"sideEffects": false,
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "2.0.
|
|
5
|
+
"version": "2.0.2",
|
|
6
6
|
"description": "JS environment check functions like `isWebkit() isSafari() isBrowser() isNode()` etc. A simple & small integration.",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./dist/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"test": "vitest run",
|
|
19
19
|
"lint": "tsc --noEmit && eslint ./src",
|
|
20
20
|
"build": "del-cli dist && tsc",
|
|
21
|
-
"release": "npm run lint &&
|
|
21
|
+
"release": "npm run lint && npm run build && np"
|
|
22
22
|
},
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
@@ -58,17 +58,17 @@
|
|
|
58
58
|
"homepage": "https://github.com/mesqueeb/is-where#readme",
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@cycraft/tsconfig": "^0.1.1",
|
|
61
|
-
"@eslint/js": "^9.
|
|
62
|
-
"@types/node": "^20.12.
|
|
61
|
+
"@eslint/js": "^9.3.0",
|
|
62
|
+
"@types/node": "^20.12.12",
|
|
63
63
|
"del-cli": "^5.1.0",
|
|
64
|
-
"eslint": "^
|
|
64
|
+
"eslint": "^9.3.0",
|
|
65
65
|
"eslint-config-prettier": "^9.1.0",
|
|
66
66
|
"np": "^10.0.5",
|
|
67
67
|
"prettier": "^3.2.5",
|
|
68
68
|
"prettier-plugin-jsdoc": "^1.3.0",
|
|
69
69
|
"typescript": "^5.4.5",
|
|
70
|
-
"typescript-eslint": "^
|
|
71
|
-
"vitest": "^1.
|
|
70
|
+
"typescript-eslint": "^8.0.0-alpha.14",
|
|
71
|
+
"vitest": "^1.6.0"
|
|
72
72
|
},
|
|
73
73
|
"np": {
|
|
74
74
|
"yarn": false,
|