@@ -130,6 +130,23 @@ class Utils {
130130
131131 /**
132132 * 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+ * ```
133150 * @param {Object } object The object to permutate.
134151 * @param {Integer } [index=0] The current key index.
135152 * @param {Object } [current={}] The current result entry being composed.
@@ -145,7 +162,7 @@ class Utils {
145162 const nextIndex = index + 1 ;
146163
147164 if ( nextIndex < keys . length ) {
148- this . getObjectKeyPermutations ( object , nextIndex , current , results ) ;
165+ Utils . getObjectKeyPermutations ( object , nextIndex , current , results ) ;
149166 } else {
150167 const result = Object . assign ( { } , current ) ;
151168 results . push ( result ) ;
@@ -178,7 +195,7 @@ class Utils {
178195 const type = types [ key ] ;
179196 const isOptional = ! ! type . o ;
180197 const param = params [ key ] ;
181- if ( ! ( isOptional && param == null ) && ( ! type . v ( param ) ) ) {
198+ if ( ! ( isOptional && param == null ) && ! type . v ( param ) ) {
182199 throw `Invalid parameter ${ key } must be of type ${ type . t } but is ${ typeof param } ` ;
183200 }
184201 }
0 commit comments