mirror of
https://github.com/186526/handlers.js
synced 2024-10-13 00:29:43 +00:00
Implements most platform-independent features
This commit is contained in:
16
src/lib.ts
Normal file
16
src/lib.ts
Normal file
@ -0,0 +1,16 @@
|
||||
export const firstUpperCase = ([first, ...rest]: string) =>
|
||||
first?.toUpperCase() + rest.join("");
|
||||
export const platform = (() => {
|
||||
if (typeof process != "undefined") {
|
||||
return "Node.js";
|
||||
}
|
||||
return "UNKNOWN";
|
||||
})();
|
||||
export const version = (() => {
|
||||
switch (platform) {
|
||||
case "Node.js":
|
||||
return process.version;
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
})();
|
Reference in New Issue
Block a user