Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #44832, comment 12


Ignore:
Timestamp:
09/07/2018 04:08:33 AM (7 years ago)
Author:
ekernercom
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #44832, comment 12

    initial v1  
    1 
    2 Better written as follows, so the condition evaluation stops on the first false:
    3 
    4 
    5 {{{
    6 if (!data || !data.secret || !data.message || !data.value) {
    7         return;
    8 }}}
    9 
    10 
    11 Replying to [comment:1 swissspidy]:
    12 > Good catch! Although your proposed change wouldn't actually return early when `data` is null.
    13 >
    14 > It would be more something like
    15 >
    16 >
    17 > {{{
    18 > if ( ! data || ! ( data.secret || data.message || data.value ) ) {
    19 >       return;
    20 > }
    21 > }}}