refactor(os): refactor EOL const (#427)

Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
This commit is contained in:
Amr Bashir
2023-06-18 13:35:07 +03:00
committed by GitHub
parent c8c3191565
commit db7f4f9a41
8 changed files with 43 additions and 10 deletions
+8 -7
View File
@@ -11,6 +11,9 @@
declare global {
interface Window {
__TAURI_INVOKE__: <T>(cmd: string, args?: unknown) => Promise<T>;
__TAURI__: {
os: { __eol: string };
};
}
}
@@ -41,18 +44,16 @@ type Arch =
| "s390x"
| "sparc64";
function isWindows(): boolean {
return navigator.appVersion.includes("Win");
}
/**
* The operating system-specific end-of-line marker.
* Returns the operating system-specific end-of-line marker.
* - `\n` on POSIX
* - `\r\n` on Windows
*
* @since 2.0.0
* */
const EOL = isWindows() ? "\r\n" : "\n";
function eol() {
return window.__TAURI__.os.__eol;
}
/**
* Returns a string describing the specific operating system in use.
@@ -174,7 +175,7 @@ async function hostname(): Promise<string | null> {
}
export {
EOL,
eol,
platform,
family,
version,