@yaasl/utils 0.11.0-alpha.2 → 0.11.0

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.
@@ -0,0 +1 @@
1
+ export declare const getWindow: () => (Window & typeof globalThis) | undefined;
@@ -1,6 +1,6 @@
1
+ export * from "./getWindow";
1
2
  export * from "./isPromiseLike";
2
3
  export * from "./log";
3
- export * from "./mockConsole";
4
4
  export * from "./sleep";
5
5
  export * from "./Thenable";
6
6
  export * from "./toVoid";
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /* eslint-disable no-restricted-globals */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.getWindow = void 0;
5
+ const isBrowserEnv = () => typeof window !== "undefined";
6
+ const getWindow = () => (isBrowserEnv() ? window : undefined);
7
+ exports.getWindow = getWindow;
package/dist/cjs/index.js CHANGED
@@ -14,9 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./getWindow"), exports);
17
18
  __exportStar(require("./isPromiseLike"), exports);
18
19
  __exportStar(require("./log"), exports);
19
- __exportStar(require("./mockConsole"), exports);
20
20
  __exportStar(require("./sleep"), exports);
21
21
  __exportStar(require("./Thenable"), exports);
22
22
  __exportStar(require("./toVoid"), exports);
@@ -0,0 +1,3 @@
1
+ /* eslint-disable no-restricted-globals */
2
+ const isBrowserEnv = () => typeof window !== "undefined";
3
+ export const getWindow = () => (isBrowserEnv() ? window : undefined);
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
+ export * from "./getWindow";
1
2
  export * from "./isPromiseLike";
2
3
  export * from "./log";
3
- export * from "./mockConsole";
4
4
  export * from "./sleep";
5
5
  export * from "./Thenable";
6
6
  export * from "./toVoid";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaasl/utils",
3
- "version": "0.11.0-alpha.2",
3
+ "version": "0.11.0",
4
4
  "description": "Utilities for @yaasl packages",
5
5
  "author": "PrettyCoffee",
6
6
  "license": "MIT",
@@ -34,11 +34,6 @@
34
34
  "lint:fix": "eslint ./src --fix",
35
35
  "validate": "run-s lint test build"
36
36
  },
37
- "eslintConfig": {
38
- "extends": [
39
- "../../.eslintrc"
40
- ]
41
- },
42
37
  "lint-staged": {
43
38
  "*.{ts,tsx}": [
44
39
  "npm run lint:fix"
@@ -1,5 +0,0 @@
1
- export declare const mockConsole: () => {
2
- error: import("vitest").Mock<unknown[], unknown>;
3
- warn: import("vitest").Mock<unknown[], unknown>;
4
- resetConsole: () => Console;
5
- };
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mockConsole = void 0;
4
- const mockConsole = () => {
5
- const oldConsole = global.console;
6
- const error = vi.fn();
7
- const warn = vi.fn();
8
- global.console = Object.assign(Object.assign({}, global.console), { error, warn });
9
- return { error, warn, resetConsole: () => (global.console = oldConsole) };
10
- };
11
- exports.mockConsole = mockConsole;
@@ -1,7 +0,0 @@
1
- export const mockConsole = () => {
2
- const oldConsole = global.console;
3
- const error = vi.fn();
4
- const warn = vi.fn();
5
- global.console = { ...global.console, error, warn };
6
- return { error, warn, resetConsole: () => (global.console = oldConsole) };
7
- };
package/tsconfig.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- }
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "include": ["./src"],
4
- "exclude": ["./**/*.test.ts"],
5
- "compilerOptions": {
6
- "declaration": false,
7
- "noEmit": false,
8
- }
9
- }