Skip to content

Commit eca52b4

Browse files
committed
fix: check for extra keys needs to be specific to schema (closes #28)
1 parent c35bc2b commit eca52b4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ export const config = options => {
4444
const schema = loadEnvironmentFile(options.schema, options.encoding, options.silent);
4545
const config = options.includeProcessEnv ? Object.assign({}, configData, process.env) : configData;
4646
const schemaKeys = Object.keys(schema);
47+
const configOnlyKeys = Object.keys(configData);
4748
const configKeys = Object.keys(config);
4849

4950
let missingKeys = schemaKeys.filter(function (key) {
5051
return configKeys.indexOf(key) < 0;
5152
});
52-
let extraKeys = configKeys.filter(function (key) {
53+
let extraKeys = configOnlyKeys.filter(function (key) {
5354
return schemaKeys.indexOf(key) < 0;
5455
});
5556
if (options.errorOnMissing && missingKeys.length) {

0 commit comments

Comments
 (0)