
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
execution-environment
Advanced tools
This module serves as a helper to expose the current execution environment.
This module serves as a helper to expose the current execution environment by reading NODE_ENV
environment variable.
$ npm install execution-environment --save
When writing a module, you may want to add conditional logic based on the execution environment. By default, the module sets default values for the dev
, test
and prod
environments:
var environment = require('environment');
var Ajax = {
get: function(method, path, params) {
if (environment.isTest()) {
throw new Error('Attempted to make a network call in the test environment. Shame!');
}
fetch(method, path, params);
}
};
module.exports = Ajax;
When Ajax#get
is executed in the test environment (defined by setting NODE_ENV=test), environment.isTest()
will return true.
Additionally, custom environments and values can be registered on the environment module using registerEnvironments
. The following code will register staging
and canary
environments, which will look for ['staging', 'stg']
and ['canary']
NODE_ENV values, respectively. Code that modifies the environment keys and values should live in a setup or config file rather modules that are require
environment.
var environment = require('environment');
environment.registerEnvironments({
staging: ['staging', 'stg'],
canary: ['canary']
});
Usage with custom environments
var environment = require('environment');
var Tracking = {
trackEvent: function(name, category, payload) {
if (environment.staging() || environment.canary()) {
return;
}
trackEsp(name, category, payload);
}
};
module.exports = Tracking;
FAQs
This module serves as a helper to expose the current execution environment.
The npm package execution-environment receives a total of 1 weekly downloads. As such, execution-environment popularity was classified as not popular.
We found that execution-environment demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers 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.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.