code: function ( options ) {
                      var label;
  
                      options || ( options = {} );
                      label = getLabel( options, this );
                      if ( isIgnoredLabel( label, this ) ) return this;
  
                      if ( getSelectionSize( this, label ) === this.length ) {
                          this.deselectAll( options );
                      } else {
                          this.selectAll( options );
                      }
  
                      return this;
                  }
docs: Toggle select all / none. If some are selected, it will select all. If all are selected, it will select none. If none are selected, it will select all.