
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
@alwatr/platform-info
Advanced tools
This module provides a way to detect the current platform where the script is running. It defines a constant `platformInfo` which holds the information about the current platform.
This module provides a way to detect the current platform where the script is running. It defines a constant platformInfo which holds the information about the current platform.
The platformInfo constant object has the following properties:
name: The name of the current platform. It can be 'browser', 'node', 'semi-node', or 'unknown'.development: A boolean indicating whether the NODE_ENV environment variable is not set to production or in browser location.hostname is localhost or 127.xxx.isNode: A boolean indicating whether the current platform is node.js.isBrowser: A boolean indicating whether the current platform is a browser.isWebWorker: A boolean indicating whether the current platform is a web worker.isDeno: A boolean indicating whether the current platform is Deno.isNw: A boolean indicating whether the current platform is nw.js.isElectron: A boolean indicating whether the current platform is Electron.The code also checks whether the script is running in development mode. If the script is running in a browser, it checks if the hostname is 'localhost' or 127.xxx. If the script is running in a 'semi-node' environment, it checks if the NODE_ENV environment variable is not set to 'production'. The result is stored in the development property of the platformInfo object.
yarn add @alwatr/platform-info
import {platformInfo} from '@alwatr/platform-info';
console.log(platformInfo.name); // 'browser' | 'node' | 'semi-node' | 'unknown'
console.log(platformInfo.development); // true | false
console.log(platformInfo.isNode); // true | false
console.log(platformInfo.isBrowser); // true | false
The following companies, organizations, and individuals support Nanolib ongoing maintenance and development. Become a Sponsor to get your logo on our README and website.
Contributions are welcome! Please read our contribution guidelines before submitting a pull request.
FAQs
This module provides a way to detect the current platform where the script is running. It defines a constant `platformInfo` which holds the information about the current platform.
The npm package @alwatr/platform-info receives a total of 1,453 weekly downloads. As such, @alwatr/platform-info popularity was classified as popular.
We found that @alwatr/platform-info demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.