File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
packages/runtime/src/enhancements/policy Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -189,15 +189,19 @@ export class PolicyUtil {
189
189
}
190
190
191
191
case 'NOT' : {
192
- const r = this . reduce ( value ) ;
193
- if ( this . isFalse ( r ) ) {
194
- // NOT false => true, thus eliminated (not adding into result)
195
- } else if ( this . isTrue ( r ) ) {
196
- // NOT true => false, eliminate all other keys and set entire condition to false
192
+ const children = enumerate ( value )
193
+ . map ( ( c : any ) => this . reduce ( c ) )
194
+ . filter ( ( c ) => c !== undefined && ! this . isFalse ( c ) ) ;
195
+ if ( children . length === 0 ) {
196
+ // all clauses are false, result is a constant true,
197
+ // thus eliminated (not adding into result)
198
+ } else if ( children . some ( ( c ) => this . isTrue ( c ) ) ) {
199
+ // some clauses are true, result is a constant false,
200
+ // eliminate all other keys and set entire condition to false
197
201
Object . keys ( result ) . forEach ( ( k ) => delete result [ k ] ) ;
198
202
result [ 'OR' ] = [ ] ; // this will cause the outer loop to exit too
199
203
} else {
200
- result [ key ] = r ;
204
+ result [ key ] = ! Array . isArray ( value ) && children . length === 1 ? children [ 0 ] : children ;
201
205
}
202
206
break ;
203
207
}
You can’t perform that action at this time.
0 commit comments