is-where 1.0.0 → 1.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/README.md CHANGED
@@ -54,16 +54,20 @@ Browsers
54
54
  - `isWebKit()`
55
55
  - `isSafari()`
56
56
 
57
- ## Meet the family
57
+ ## Meet the family (more tiny utils with TS support)
58
58
 
59
59
  - [is-what 🙉](https://github.com/mesqueeb/is-what)
60
60
  - [is-where 🙈](https://github.com/mesqueeb/is-where)
61
61
  - [merge-anything 🥡](https://github.com/mesqueeb/merge-anything)
62
+ - [check-anything 👁](https://github.com/mesqueeb/check-anything)
63
+ - [remove-anything ✂️](https://github.com/mesqueeb/remove-anything)
64
+ - [getorset-anything 🐊](https://github.com/mesqueeb/getorset-anything)
65
+ - [map-anything 🗺](https://github.com/mesqueeb/map-anything)
62
66
  - [filter-anything ⚔️](https://github.com/mesqueeb/filter-anything)
63
- - [find-and-replace-anything 🎣](https://github.com/mesqueeb/find-and-replace-anything)
64
- - [compare-anything 🛰](https://github.com/mesqueeb/compare-anything)
65
67
  - [copy-anything 🎭](https://github.com/mesqueeb/copy-anything)
68
+ - [case-anything 🐫](https://github.com/mesqueeb/case-anything)
66
69
  - [flatten-anything 🏏](https://github.com/mesqueeb/flatten-anything)
70
+ - [nestify-anything 🧅](https://github.com/mesqueeb/nestify-anything)
67
71
 
68
72
  ## Source code
69
73
 
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ function isNode() {
4
+ return typeof process !== "undefined" && process.versions != null && process.versions.node != null;
5
+ }
6
+ function isBrowser() {
7
+ return typeof window !== "undefined" && typeof window.document !== "undefined";
8
+ }
9
+ function isWebWorker() {
10
+ return typeof self === "object" && self.constructor && self.constructor.name === "DedicatedWorkerGlobalScope";
11
+ }
12
+ function isJsDom() {
13
+ return typeof window !== "undefined" && window.name === "nodejs" || typeof navigator !== "undefined" && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
14
+ }
15
+ function isDeno() {
16
+ return typeof Deno !== "undefined" && typeof Deno.core !== "undefined";
17
+ }
18
+ function isWebKit() {
19
+ return isBrowser() && !!navigator.vendor && navigator.vendor.indexOf("Apple") !== -1 && !!navigator.userAgent;
20
+ }
21
+ function isSafari() {
22
+ return isBrowser() && !!navigator.vendor && navigator.vendor.indexOf("Apple") !== -1 && !!navigator.userAgent && navigator.userAgent.indexOf("CriOS") == -1 && navigator.userAgent.indexOf("FxiOS") == -1;
23
+ }
24
+
25
+ exports.isBrowser = isBrowser;
26
+ exports.isDeno = isDeno;
27
+ exports.isJsDom = isJsDom;
28
+ exports.isNode = isNode;
29
+ exports.isSafari = isSafari;
30
+ exports.isWebKit = isWebKit;
31
+ exports.isWebWorker = isWebWorker;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * returns `true` if the current environment is Node
3
+ */
4
+ declare function isNode(): boolean;
5
+ /**
6
+ * returns `true` if the current environment is a browser
7
+ */
8
+ declare function isBrowser(): boolean;
9
+ /**
10
+ * returns `true` if the current environment is a Web Worker
11
+ */
12
+ declare function isWebWorker(): boolean;
13
+ /**
14
+ * returns `true` if the current environment is JS DOM
15
+ */
16
+ declare function isJsDom(): boolean;
17
+ /**
18
+ * returns `true` if the current environment is Deno
19
+ */
20
+ declare function isDeno(): boolean;
21
+ /**
22
+ * returns `true` if the current browser is based on WebKit
23
+ *
24
+ * This includes:
25
+ * - Safari on macOS
26
+ * - Safari on iOS & iPadOS
27
+ * - Google Chrome on iOS & iPadOS
28
+ * - Firefox on iOS & iPadOS
29
+ * - ... on iOS & iPadOS
30
+ *
31
+ * All mobile browsers on iOS & iPadOS use WebKit
32
+ */
33
+ declare function isWebKit(): boolean;
34
+ /**
35
+ * returns `true` if the current browser is Safari
36
+ *
37
+ * This includes:
38
+ * - Safari on macOS
39
+ * - Safari on iOS & iPadOS
40
+ *
41
+ * It does not include other browser on iOS & iPadOS
42
+ */
43
+ declare function isSafari(): boolean;
44
+
45
+ export { isBrowser, isDeno, isJsDom, isNode, isSafari, isWebKit, isWebWorker };
@@ -1,43 +1,45 @@
1
- /**
2
- * returns `true` if the current environment is Node
3
- */
4
- export declare function isNode(): boolean;
5
- /**
6
- * returns `true` if the current environment is a browser
7
- */
8
- export declare function isBrowser(): boolean;
9
- /**
10
- * returns `true` if the current environment is a Web Worker
11
- */
12
- export declare function isWebWorker(): boolean;
13
- /**
14
- * returns `true` if the current environment is JS DOM
15
- */
16
- export declare function isJsDom(): boolean;
17
- /**
18
- * returns `true` if the current environment is Deno
19
- */
20
- export declare function isDeno(): boolean;
21
- /**
22
- * returns `true` if the current browser is based on WebKit
23
- *
24
- * This includes:
25
- * - Safari on macOS
26
- * - Safari on iOS & iPadOS
27
- * - Google Chrome on iOS & iPadOS
28
- * - Firefox on iOS & iPadOS
29
- * - ... on iOS & iPadOS
30
- *
31
- * All mobile browsers on iOS & iPadOS use WebKit
32
- */
33
- export declare function isWebKit(): boolean;
34
- /**
35
- * returns `true` if the current browser is Safari
36
- *
37
- * This includes:
38
- * - Safari on macOS
39
- * - Safari on iOS & iPadOS
40
- *
41
- * It does not include other browser on iOS & iPadOS
42
- */
43
- export declare function isSafari(): boolean;
1
+ /**
2
+ * returns `true` if the current environment is Node
3
+ */
4
+ declare function isNode(): boolean;
5
+ /**
6
+ * returns `true` if the current environment is a browser
7
+ */
8
+ declare function isBrowser(): boolean;
9
+ /**
10
+ * returns `true` if the current environment is a Web Worker
11
+ */
12
+ declare function isWebWorker(): boolean;
13
+ /**
14
+ * returns `true` if the current environment is JS DOM
15
+ */
16
+ declare function isJsDom(): boolean;
17
+ /**
18
+ * returns `true` if the current environment is Deno
19
+ */
20
+ declare function isDeno(): boolean;
21
+ /**
22
+ * returns `true` if the current browser is based on WebKit
23
+ *
24
+ * This includes:
25
+ * - Safari on macOS
26
+ * - Safari on iOS & iPadOS
27
+ * - Google Chrome on iOS & iPadOS
28
+ * - Firefox on iOS & iPadOS
29
+ * - ... on iOS & iPadOS
30
+ *
31
+ * All mobile browsers on iOS & iPadOS use WebKit
32
+ */
33
+ declare function isWebKit(): boolean;
34
+ /**
35
+ * returns `true` if the current browser is Safari
36
+ *
37
+ * This includes:
38
+ * - Safari on macOS
39
+ * - Safari on iOS & iPadOS
40
+ *
41
+ * It does not include other browser on iOS & iPadOS
42
+ */
43
+ declare function isSafari(): boolean;
44
+
45
+ export { isBrowser, isDeno, isJsDom, isNode, isSafari, isWebKit, isWebWorker };
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ function isNode() {
2
+ return typeof process !== "undefined" && process.versions != null && process.versions.node != null;
3
+ }
4
+ function isBrowser() {
5
+ return typeof window !== "undefined" && typeof window.document !== "undefined";
6
+ }
7
+ function isWebWorker() {
8
+ return typeof self === "object" && self.constructor && self.constructor.name === "DedicatedWorkerGlobalScope";
9
+ }
10
+ function isJsDom() {
11
+ return typeof window !== "undefined" && window.name === "nodejs" || typeof navigator !== "undefined" && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
12
+ }
13
+ function isDeno() {
14
+ return typeof Deno !== "undefined" && typeof Deno.core !== "undefined";
15
+ }
16
+ function isWebKit() {
17
+ return isBrowser() && !!navigator.vendor && navigator.vendor.indexOf("Apple") !== -1 && !!navigator.userAgent;
18
+ }
19
+ function isSafari() {
20
+ return isBrowser() && !!navigator.vendor && navigator.vendor.indexOf("Apple") !== -1 && !!navigator.userAgent && navigator.userAgent.indexOf("CriOS") == -1 && navigator.userAgent.indexOf("FxiOS") == -1;
21
+ }
22
+
23
+ export { isBrowser, isDeno, isJsDom, isNode, isSafari, isWebKit, isWebWorker };
package/package.json CHANGED
@@ -1,17 +1,22 @@
1
1
  {
2
2
  "name": "is-where",
3
- "sideEffects": false,
4
- "type": "module",
5
- "version": "1.0.0",
3
+ "version": "1.0.2",
6
4
  "description": "JS environment check functions like `isWebkit() isSafari() isBrowser() isNode()` etc. A simple & small integration.",
7
- "module": "./dist/index.es.js",
8
- "main": "./dist/index.cjs",
9
- "types": "./dist/types/index.d.ts",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "types": "./dist/index.d.ts",
8
+ "module": "./dist/index.js",
9
+ "main": "./dist/index.js",
10
10
  "exports": {
11
11
  ".": {
12
- "import": "./dist/index.es.js",
13
- "require": "./dist/index.cjs",
14
- "types": "./dist/types/index.d.ts"
12
+ "require": {
13
+ "types": "./dist/cjs/index.d.cts",
14
+ "default": "./dist/cjs/index.cjs"
15
+ },
16
+ "import": {
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.js"
19
+ }
15
20
  }
16
21
  },
17
22
  "files": [
@@ -23,7 +28,7 @@
23
28
  "scripts": {
24
29
  "test": "vitest run",
25
30
  "lint": "tsc --noEmit && eslint ./src --ext .ts",
26
- "build": "rollup -c ./scripts/build.js",
31
+ "build": "rollup -c ./rollup.config.js",
27
32
  "release": "npm run lint && del dist && npm run build && np"
28
33
  },
29
34
  "repository": {
@@ -63,18 +68,19 @@
63
68
  },
64
69
  "homepage": "https://github.com/mesqueeb/is-where#readme",
65
70
  "devDependencies": {
66
- "@typescript-eslint/eslint-plugin": "^5.10.1",
67
- "@typescript-eslint/parser": "^5.10.1",
68
- "del-cli": "^4.0.1",
69
- "eslint": "^8.7.0",
70
- "eslint-config-prettier": "^8.3.0",
71
+ "@typescript-eslint/eslint-plugin": "^5.59.2",
72
+ "@typescript-eslint/parser": "^5.59.2",
73
+ "del-cli": "^5.0.0",
74
+ "eslint": "^8.40.0",
75
+ "eslint-config-prettier": "^8.8.0",
71
76
  "eslint-plugin-tree-shaking": "^1.10.0",
72
- "np": "^7.6.0",
73
- "prettier": "^2.5.1",
74
- "rollup": "^2.66.1",
75
- "rollup-plugin-typescript2": "^0.31.1",
76
- "typescript": "^4.5.5",
77
- "vitest": "^0.2.3"
77
+ "np": "^7.7.0",
78
+ "prettier": "^2.8.8",
79
+ "rollup": "^3.23.0",
80
+ "rollup-plugin-dts": "^5.3.0",
81
+ "rollup-plugin-esbuild": "^5.0.0",
82
+ "typescript": "^4.9.5",
83
+ "vitest": "^0.31.0"
78
84
  },
79
85
  "ava": {
80
86
  "extensions": {
package/dist/index.cjs DELETED
@@ -1,82 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- /**
6
- * returns `true` if the current environment is Node
7
- */
8
- function isNode() {
9
- return typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
10
- }
11
- /**
12
- * returns `true` if the current environment is a browser
13
- */
14
- function isBrowser() {
15
- return typeof window !== 'undefined' && typeof window.document !== 'undefined';
16
- }
17
- /**
18
- * returns `true` if the current environment is a Web Worker
19
- */
20
- function isWebWorker() {
21
- return (typeof self === 'object' &&
22
- self.constructor &&
23
- self.constructor.name === 'DedicatedWorkerGlobalScope');
24
- }
25
- /**
26
- * returns `true` if the current environment is JS DOM
27
- */
28
- function isJsDom() {
29
- return ((typeof window !== 'undefined' && window.name === 'nodejs') ||
30
- (typeof navigator !== 'undefined' &&
31
- (navigator.userAgent.includes('Node.js') || navigator.userAgent.includes('jsdom'))));
32
- }
33
- /**
34
- * returns `true` if the current environment is Deno
35
- */
36
- function isDeno() {
37
- // @ts-ignore
38
- return typeof Deno !== 'undefined' && typeof Deno.core !== 'undefined';
39
- }
40
- /**
41
- * returns `true` if the current browser is based on WebKit
42
- *
43
- * This includes:
44
- * - Safari on macOS
45
- * - Safari on iOS & iPadOS
46
- * - Google Chrome on iOS & iPadOS
47
- * - Firefox on iOS & iPadOS
48
- * - ... on iOS & iPadOS
49
- *
50
- * All mobile browsers on iOS & iPadOS use WebKit
51
- */
52
- function isWebKit() {
53
- return (isBrowser() &&
54
- !!navigator.vendor &&
55
- navigator.vendor.indexOf('Apple') !== -1 &&
56
- !!navigator.userAgent);
57
- }
58
- /**
59
- * returns `true` if the current browser is Safari
60
- *
61
- * This includes:
62
- * - Safari on macOS
63
- * - Safari on iOS & iPadOS
64
- *
65
- * It does not include other browser on iOS & iPadOS
66
- */
67
- function isSafari() {
68
- return (isBrowser() &&
69
- !!navigator.vendor &&
70
- navigator.vendor.indexOf('Apple') !== -1 &&
71
- !!navigator.userAgent &&
72
- navigator.userAgent.indexOf('CriOS') == -1 &&
73
- navigator.userAgent.indexOf('FxiOS') == -1);
74
- }
75
-
76
- exports.isBrowser = isBrowser;
77
- exports.isDeno = isDeno;
78
- exports.isJsDom = isJsDom;
79
- exports.isNode = isNode;
80
- exports.isSafari = isSafari;
81
- exports.isWebKit = isWebKit;
82
- exports.isWebWorker = isWebWorker;
package/dist/index.es.js DELETED
@@ -1,72 +0,0 @@
1
- /**
2
- * returns `true` if the current environment is Node
3
- */
4
- function isNode() {
5
- return typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
6
- }
7
- /**
8
- * returns `true` if the current environment is a browser
9
- */
10
- function isBrowser() {
11
- return typeof window !== 'undefined' && typeof window.document !== 'undefined';
12
- }
13
- /**
14
- * returns `true` if the current environment is a Web Worker
15
- */
16
- function isWebWorker() {
17
- return (typeof self === 'object' &&
18
- self.constructor &&
19
- self.constructor.name === 'DedicatedWorkerGlobalScope');
20
- }
21
- /**
22
- * returns `true` if the current environment is JS DOM
23
- */
24
- function isJsDom() {
25
- return ((typeof window !== 'undefined' && window.name === 'nodejs') ||
26
- (typeof navigator !== 'undefined' &&
27
- (navigator.userAgent.includes('Node.js') || navigator.userAgent.includes('jsdom'))));
28
- }
29
- /**
30
- * returns `true` if the current environment is Deno
31
- */
32
- function isDeno() {
33
- // @ts-ignore
34
- return typeof Deno !== 'undefined' && typeof Deno.core !== 'undefined';
35
- }
36
- /**
37
- * returns `true` if the current browser is based on WebKit
38
- *
39
- * This includes:
40
- * - Safari on macOS
41
- * - Safari on iOS & iPadOS
42
- * - Google Chrome on iOS & iPadOS
43
- * - Firefox on iOS & iPadOS
44
- * - ... on iOS & iPadOS
45
- *
46
- * All mobile browsers on iOS & iPadOS use WebKit
47
- */
48
- function isWebKit() {
49
- return (isBrowser() &&
50
- !!navigator.vendor &&
51
- navigator.vendor.indexOf('Apple') !== -1 &&
52
- !!navigator.userAgent);
53
- }
54
- /**
55
- * returns `true` if the current browser is Safari
56
- *
57
- * This includes:
58
- * - Safari on macOS
59
- * - Safari on iOS & iPadOS
60
- *
61
- * It does not include other browser on iOS & iPadOS
62
- */
63
- function isSafari() {
64
- return (isBrowser() &&
65
- !!navigator.vendor &&
66
- navigator.vendor.indexOf('Apple') !== -1 &&
67
- !!navigator.userAgent &&
68
- navigator.userAgent.indexOf('CriOS') == -1 &&
69
- navigator.userAgent.indexOf('FxiOS') == -1);
70
- }
71
-
72
- export { isBrowser, isDeno, isJsDom, isNode, isSafari, isWebKit, isWebWorker };