Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
environment
Advanced tools
Provides node's `process.env` object functionality as stand-alone functions instead of a C++ fake object that does weird things. As an added bonus, if running node with Proxies enabled ("node --harmony") it also exports a function that creates an `Environment` object that is similar to `process.env` but behaves like a real object.
Readme
Provides node's process.env
object functionality as stand-alone functions instead of a C++ fake object that does weird things. As an added bonus, if running node with Proxies enabled ("node --harmony") it also exports a function that creates an Environment
object that is similar to process.env
but behaves like a real object.
npm install environment
Mostly self-explanatory:
If Proxy
is available, due to running node using the --harmony
flag, a constructor is exported as well which allows the creation of Environment
objects.
These objects aren't entirely normal JavaScript objects, but they're much closer than node's process.env
. Environment.prototype
doesn't inherit from Object.prototype
but it does have most of the functions from it. toString
, valueOf
, isPrototypeOf
, hasOwnProperty
, as well as constructor
pointing to Environment
.
It's possible to add methods to Environment.prototype
and have them work on instances correctly. It's possible to change an instance's __proto__
and point it to something else and also have that work correctly (though Object.getPrototypeOf may not reflect the change).
// normal creation
var env = require('environment').create();
// or modifying the prototype
var Environment = require('environment');
Environment.prototype.paths = function paths(){
return this.PATH.split(process.platform === 'win32' ? ';' : ':');
}
var env = new Environment;
console.log(env.paths());
FAQs
Check which JavaScript environment your code is running in at runtime: browser, Node.js, Bun, etc
The npm package environment receives a total of 338,171 weekly downloads. As such, environment popularity was classified as popular.
We found that environment 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
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.