tinky-figures 1.0.1 → 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.
@@ -8,8 +8,8 @@ import { FiguresMap } from "../types/figures.js";
8
8
  *
9
9
  * Adapted from `sindresorhus/is-unicode-supported`.
10
10
  *
11
- * @param platform - The operating system platform (default: `process.platform`).
12
- * @param env - The environment variables object (default: `process.env`).
11
+ * @param platform - The operating system platform.
12
+ * @param env - The environment variables object.
13
13
  * @returns `true` if Unicode is supported, `false` otherwise.
14
14
  */
15
15
  export declare function isUnicodeSupported(platform?: string, env?: Record<string, string | undefined>): boolean;
@@ -11,32 +11,33 @@ import { asciiFigures } from "../data/ascii.js";
11
11
  *
12
12
  * Adapted from `sindresorhus/is-unicode-supported`.
13
13
  *
14
- * @param platform - The operating system platform (default: `process.platform`).
15
- * @param env - The environment variables object (default: `process.env`).
14
+ * @param platform - The operating system platform.
15
+ * @param env - The environment variables object.
16
16
  * @returns `true` if Unicode is supported, `false` otherwise.
17
17
  */
18
- export function isUnicodeSupported(platform = process.platform, env = process.env) {
18
+ export function isUnicodeSupported(platform, env) {
19
19
  // If explicitly set via environment variable, use that
20
- if (env.TINKY_UNICODE === "true") {
20
+ if (env?.TINKY_UNICODE === "true") {
21
21
  return true;
22
22
  }
23
- if (env.TINKY_UNICODE === "false") {
23
+ if (env?.TINKY_UNICODE === "false") {
24
24
  return false;
25
25
  }
26
- const { TERM, TERM_PROGRAM } = env;
26
+ const TERM = env?.TERM;
27
+ const TERM_PROGRAM = env?.TERM_PROGRAM;
27
28
  if (platform !== "win32") {
28
29
  return TERM !== "linux"; // Linux console (kernel)
29
30
  }
30
- return (Boolean(env.WT_SESSION) || // Windows Terminal
31
- Boolean(env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
32
- env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
31
+ return (Boolean(env?.WT_SESSION) || // Windows Terminal
32
+ Boolean(env?.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
33
+ env?.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
33
34
  TERM_PROGRAM === "Terminus-Sublime" ||
34
35
  TERM_PROGRAM === "vscode" ||
35
36
  TERM === "xterm-256color" ||
36
37
  TERM === "alacritty" ||
37
38
  TERM === "rxvt-unicode" ||
38
39
  TERM === "rxvt-unicode-256color" ||
39
- env.TERMINAL_EMULATOR === "JetBrains-JediTerm");
40
+ env?.TERMINAL_EMULATOR === "JetBrains-JediTerm");
40
41
  }
41
42
  /**
42
43
  * A React hook that provides a set of figure characters appropriate for the current environment.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinky-figures",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Unicode symbols with ASCII fallbacks for tinky applications",
5
5
  "keywords": [
6
6
  "tinky",