Skip to content

Commit

Permalink
Merge pull request #113 from samchon/features/esm.sh
Browse files Browse the repository at this point in the history
Compatible with https://esm.sh
  • Loading branch information
samchon authored Mar 27, 2024
2 parents 5d60d6a + b27b91e commit c643412
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 91 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"email": "[email protected]",
"url": "https://github.com/samchon"
},
"version": "2.5.13",
"version": "2.5.16",
"typings": "./index.d.ts",
"main": "./index.js",
"scripts": {
Expand Down
71 changes: 0 additions & 71 deletions src/exception/global.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/exception/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,3 @@ export * from "./SystemError";
export * from "./ErrorCategory";
export * from "./ErrorCode";
export * from "./ErrorCondition";

export * from "./global";
10 changes: 0 additions & 10 deletions src/test/exception/test_terminate.ts

This file was deleted.

25 changes: 18 additions & 7 deletions src/utility/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,30 @@
* @module std
*/
//================================================================
let is_node_: boolean | null = null;

/**
* Test whether the code is running on NodeJS.
*
* @return Whether NodeJS or not.
*/
export function is_node(): boolean {
if (is_node_ === null)
is_node_ =
typeof global === "object" &&
typeof global.process === "object" &&
typeof global.process.versions === "object" &&
typeof global.process.versions.node !== "undefined";
is_node_ = typeof global === "object" && is_node_process(global);
return is_node_;
}

/**
* @internal
*/
function is_node_process(m: typeof global | null): boolean {
return m !== null &&
typeof m.process === "object" &&
m.process !== null &&
typeof m.process.versions === "object" &&
m.process.versions !== null &&
typeof m.process.versions.node !== "undefined";
}

/**
* @internal
*/
let is_node_: boolean | null = null;

0 comments on commit c643412

Please sign in to comment.