
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
valid-config
Advanced tools
Define and validate configuration with an extended json schema.
npm install --save valid-config
const validConfig = require('valid-config');
process.env.FOO = 'bar';
const config = validConfig({
type: 'object',
properties: {
foo: {
type: 'string',
env: 'FOO'
}
}
});
deepEqual(config, {
foo: 'bar'
});
const validConfig = require('valid-config');
process.env.FOO = 'bar';
const configFile1 = {
baz: 'xyz'
};
const configFile2 = {
baz: 'jkw'
};
const config = validConfig({
type: 'object',
properties: {
foo: {
type: 'string',
env: 'FOO'
}
}
}, configFile1, configFile2);
deepEqual(config, {
foo: 'bar',
baz: 'jkw'
});
const validConfig = require('valid-config');
const config = validConfig({
type: 'object',
properties: {
port: {
type: 'number',
env: 'PORT',
default: 3000
}
}
});
deepEqual(config, {
port: 3000
});
process.env.PORT = '3001';
const configFile1 = {
port: 8000
};
const validConfig = require('valid-config');
const config = validConfig({
type: 'object',
properties: {
port: {
type: 'number',
env: 'PORT',
default: 3000
}
}
});
deepEqual(config, {
port: 3001
});
const validConfig = require('valid-config');
process.env.PORT = '3000';
const config = validConfig({
type: 'object',
properties: {
port: {
type: 'number',
env: 'PORT'
}
}
});
deepEqual(config, {
port: 3000
});
process.env.FOO = 'bar,baz';
const config = validConfig({
type: 'object',
properties: {
foo: {
type: 'array',
items: {
type: 'string'
},
env: 'FOO'
}
}
});
deepEqual(config, {
foo: ['bar', 'baz']
});
process.env.FOO = 'bar::baz';
const config = validConfig({
type: 'object',
properties: {
foo: {
type: 'array',
items: {
type: 'string'
},
env: 'FOO'
envSeparator: '::'
}
}
});
deepEqual(config, {
foo: ['bar', 'baz']
});
throws(function() {
validConfig({
type: 'object',
properties: {
foo: {
type: 'string',
env: 'FOO'
}
},
required: [
'foo'
]
});
});
throws(function() {
const configFile = {};
validConfig({
type: 'object',
properties: {
foo: {
type: 'array',
items: {
type: 'string'
},
minItems: 1
}
}
}, configFile);
});
FAQs
Define and validate configuration with json schema
The npm package valid-config receives a total of 3 weekly downloads. As such, valid-config popularity was classified as not popular.
We found that valid-config 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.