@naturalcycles/js-lib
Version:
Standard library for universal (browser + Node.js) javascript
21 lines (20 loc) • 561 B
TypeScript
/**
* Use it to detect SSR/Node.js environment.
*
* Will return `true` in Node.js.
* Will return `false` in the Browser.
*/
export declare function isServerSide(): boolean;
/**
* Use it to detect Browser (not SSR/Node) environment.
*
* Will return `true` in the Browser.
* Will return `false` in Node.js.
*/
export declare function isClientSide(): boolean;
/**
* Almost the same as isServerSide()
* (isServerSide should return true for Node),
* but detects Node specifically (not Deno, not Bun, etc).
*/
export declare function isNode(): boolean;