Skip to content

Commit

Permalink
fix: check for extra keys needs to be specific to schema (closes #28)
Browse files Browse the repository at this point in the history
  • Loading branch information
niftylettuce committed Dec 13, 2019
1 parent c35bc2b commit eca52b4
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 eca52b4

Please sign in to comment.