
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
schema like definitions for environment variables, throws an exception when missing required variables. Has a few helper methods exposed for filtering, merging an objects keys, and a few other things.'
schema like definitions for environment variables, throws an exception when missing required variables. Has a few helper methods exposed for filtering, merging an objects keys, and a few other things.
const envstrict = require('envstrict');
const envs = envstrict([{
key: 'NODE_ENV',
required: false,
default: 'development',
transformer: (val) => val.toUpperCase(),
rename: 'environment',
mutate: true
}, {
key: 'PORT',
required: true
}, {
key: 'FILE_PATHS',
delim: /,\s?/,
default: '~/app/dir1,~/app/dir2,~/app/dir3'
}]);
.add
, .and
, .get
- Aliased method to add after initial object creation.
const envstrict = require('envstrict');
const envs = envstrict([ /* objects go here */ ]);
envs.add({ key: 'SOME_ENV_VAR' });
$ npm test
> envstrict@1.2.5 test /home/higgamuffin/code/envstrict
> mocha test/ -R spec
Tests for EnvStrict
✓ should have transformed the key for `NODE_ENV` to `environment`
✓ should be able to transform `environment` value to `DEVELOPMENT`
✓ should be able to delimit `FILE_PATHS` to an array
✓ throws an error when a required key is not found
✓ should accept an object instead of an array
✓ should be able to add variables after initial object creation
✓ throws an error if passed an undefined
✓ should be able to handle undefined keys when mutate is `true`
✓ should be able to transform a `String` as an object key
✓ should be able to transform a `Number` as an object key
✓ should be able to transform a `Boolean` as an object key
11 passing (23ms)
FAQs
schema like definitions for environment variables, throws an exception when missing required variables. Has a few helper methods exposed for filtering, merging an objects keys, and a few other things.'
The npm package envstrict receives a total of 0 weekly downloads. As such, envstrict popularity was classified as not popular.
We found that envstrict demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.