Skip to content

Commit

Permalink
fix: check for extra keys needs to be specific to schema (closes… (#29)
Browse files Browse the repository at this point in the history
fix: check for extra keys needs to be specific to schema (closes #28)
  • Loading branch information
niftylettuce authored Dec 13, 2019
2 parents c35bc2b + eca52b4 commit 60594f6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ export const config = options => {
const schema = loadEnvironmentFile(options.schema, options.encoding, options.silent);
const config = options.includeProcessEnv ? Object.assign({}, configData, process.env) : configData;
const schemaKeys = Object.keys(schema);
const configOnlyKeys = Object.keys(configData);
const configKeys = Object.keys(config);

let missingKeys = schemaKeys.filter(function (key) {
return configKeys.indexOf(key) < 0;
});
let extraKeys = configKeys.filter(function (key) {
let extraKeys = configOnlyKeys.filter(function (key) {
return schemaKeys.indexOf(key) < 0;
});
if (options.errorOnMissing && missingKeys.length) {
Expand Down

0 comments on commit 60594f6

Please sign in to comment.