@trenskow/config 3.0.34 → 3.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +10 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -86,7 +86,8 @@ export default async (schema = {}, options = {}) => {
86
86
 
87
87
  options = merge({
88
88
  defaults: {
89
- unknownKeys: 'allow'
89
+ unknownKeys: 'allow',
90
+ stopOnFirstError: false
90
91
  }
91
92
  }, options);
92
93
 
@@ -96,12 +97,15 @@ export default async (schema = {}, options = {}) => {
96
97
  schema,
97
98
  options);
98
99
  } catch (error) {
99
- if (error.keyPath) {
100
- error.keyPath = caseit(error.keyPath
101
- .filter((part) => part)
102
- .join('.'), 'snake').toUpperCase();
103
- }
100
+ (error.errors || [error]).forEach((error) => {
101
+ if (error.keyPath) {
102
+ error.keyPath = caseit(error.keyPath
103
+ .filter((part) => part)
104
+ .join('.'), 'snake').toUpperCase();
105
+ }
106
+ });
104
107
  throw error;
108
+
105
109
  }
106
110
 
107
111
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trenskow/config",
3
- "version": "3.0.34",
3
+ "version": "3.0.35",
4
4
  "description": "Converts `process.env` into a neatly packed object.",
5
5
  "main": "index.js",
6
6
  "type": "module",