@@ -130,6 +130,23 @@ class Utils {
130
130
131
131
/**
132
132
* Creates an object with all permutations of the original keys.
133
+ * For example, this definition:
134
+ * ```
135
+ * {
136
+ * a: [true, false],
137
+ * b: [1, 2],
138
+ * c: ['x']
139
+ * }
140
+ * ```
141
+ * permutates to:
142
+ * ```
143
+ * [
144
+ * { a: true, b: 1, c: 'x' },
145
+ * { a: true, b: 2, c: 'x' },
146
+ * { a: false, b: 1, c: 'x' },
147
+ * { a: false, b: 2, c: 'x' }
148
+ * ]
149
+ * ```
133
150
* @param {Object } object The object to permutate.
134
151
* @param {Integer } [index=0] The current key index.
135
152
* @param {Object } [current={}] The current result entry being composed.
@@ -145,7 +162,7 @@ class Utils {
145
162
const nextIndex = index + 1 ;
146
163
147
164
if ( nextIndex < keys . length ) {
148
- this . getObjectKeyPermutations ( object , nextIndex , current , results ) ;
165
+ Utils . getObjectKeyPermutations ( object , nextIndex , current , results ) ;
149
166
} else {
150
167
const result = Object . assign ( { } , current ) ;
151
168
results . push ( result ) ;
@@ -178,7 +195,7 @@ class Utils {
178
195
const type = types [ key ] ;
179
196
const isOptional = ! ! type . o ;
180
197
const param = params [ key ] ;
181
- if ( ! ( isOptional && param == null ) && ( ! type . v ( param ) ) ) {
198
+ if ( ! ( isOptional && param == null ) && ! type . v ( param ) ) {
182
199
throw `Invalid parameter ${ key } must be of type ${ type . t } but is ${ typeof param } ` ;
183
200
}
184
201
}
0 commit comments