File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -226,7 +226,10 @@ export class FormValueService {
226
226
*/
227
227
private containsNonEmptyValues ( object : object ) : boolean {
228
228
const values = Object . keys ( object ) . map ( key => object [ key ] ) ;
229
- return values . some ( x => ( x !== null &&
230
- ( typeof x === 'object' && x . constructor === Object ? this . containsNonEmptyValues ( x ) : x !== '' ) ) ) ;
229
+ const objectRefs = [ ] ;
230
+ // Note that pushing to an array is truthy (returns new length of the array), hence using ! to make it falsy
231
+ const hasNonNullPrimitive = values . some ( x => ( x !== null &&
232
+ ( typeof x === 'object' && x . constructor === Object ? ! objectRefs . push ( x ) : x !== '' ) ) ) ;
233
+ return ! hasNonNullPrimitive ? objectRefs . some ( y => this . containsNonEmptyValues ( y ) ) : hasNonNullPrimitive ;
231
234
}
232
235
}
You can’t perform that action at this time.
0 commit comments