Socket
Socket
Sign inDemoInstall

@probe.gl/env

Package Overview
Dependencies
Maintainers
3
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@probe.gl/env

JavaScript environment detection for browser and Node


Version published
Weekly downloads
260K
decreased by-3.68%
Maintainers
3
Weekly downloads
 
Created

What is @probe.gl/env?

@probe.gl/env is a utility library designed to help with environment detection and configuration in JavaScript applications. It provides tools to detect the runtime environment, manage environment variables, and handle logging and debugging.

What are @probe.gl/env's main functionalities?

Environment Detection

This feature allows you to detect whether your code is running in a browser or Node.js environment. The code sample demonstrates how to use the `isBrowser` and `isNode` functions to log the current environment.

const { isBrowser, isNode } = require('@probe.gl/env');

if (isBrowser) {
  console.log('Running in a browser environment');
} else if (isNode) {
  console.log('Running in a Node.js environment');
}

Environment Variables

This feature helps you manage environment variables. The `getEnv` function retrieves the value of an environment variable, with an optional default value if the variable is not set. The code sample shows how to get the `API_URL` environment variable.

const { getEnv } = require('@probe.gl/env');

const apiUrl = getEnv('API_URL', 'https://default.api.url');
console.log(`API URL: ${apiUrl}`);

Logging and Debugging

This feature provides logging and debugging utilities. The `log` object offers methods like `info`, `warn`, and `error` to log messages at different levels. The code sample demonstrates how to use these logging methods.

const { log } = require('@probe.gl/env');

log.info('This is an info message');
log.warn('This is a warning message');
log.error('This is an error message');

Other packages similar to @probe.gl/env

Keywords

FAQs

Package last updated on 23 Feb 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc