src/model/vizmapper.js
/**
   * Set or get the global node style for a property
   * @param {Cytoscape.Collection} eles The elements to be set or gotten (must be one element for getting)
   * @param {String} property The property name
   * @param {StyleStruct} [value] When specified, the bypass is set to this value.  When unspecified, the current value is returned.
   * @returns {StyleStruct} The current style (when `value` is unspecified)
   */
Set or get the global node style for a property
@param {Cytoscape.Collection} eles The elements to be set or gotten (must be one element for getting)
@param {String} property The property name
@param {StyleStruct} [value] When specified, the bypass is set to this value.  When unspecified, the current value is returned.
@returns {StyleStruct} The current style (when `value` is unspecified)
Set or get the global node style for a property @param { Cytoscape . Collection } eles The elements to be set or gotten ( must be one element for getting ) @param { String } property The property name @param { StyleStruct } [ value ] When specified the bypass is set to this value . When unspecified the current value is returned . @returns { StyleStruct } The current style ( when ` value ` is unspecified )
bypass(eles, property, value){
    if(value || value === null) {
      assertElesNonempty(eles);
      assertPropertyIsSupported(property);
      assertBypassValueIsSupported(value, property);
      if(value !== null && value.mapping !== MAPPING.VALUE) {
        throw new Error(`Can't set a bypass to a mapper`);
      }
      const _bypasses = this.cy.data('_bypasses') || {};
      const ids = eles.map(ele => ele.id());
      if(value === null)
        ids.forEach(id => _.unset(_bypasses, [id, property]));
      else
        ids.forEach(id => _.set(_bypasses, [id, property], value));
      this.cy.data({ _bypasses });
      this.cy.emit('vmbypass', eles, property, value);
    } else {
      const ele = eles;
      assertElesNonempty(ele);
      assertPropertyIsSupported(property);
      const _bypasses = this.cy.data('_bypasses') || {};
      const ret = [];
      const ids = eles.slice(0,5).map(ele => ele.id());
      ids.forEach(id => {
        const styleVal = _.get(_bypasses, [id, property, 'value']) || 'unset';
        const existing = ret.find(e => e.styleVal == styleVal);
        if(existing) {
          existing.ids.push(id);
        } else {
          ret.push({ styleVal, ids:[id] });
        }
      });
      ret.sort((s1, s2) => s1.ids.length - s2.ids.length);
      return ret;
    }
  }
bypass ( eles , property , value ) { if ( value || value === null ) { assertElesNonempty ( eles ) ; assertPropertyIsSupported ( property ) ; assertBypassValueIsSupported ( value , property ) ; if ( value !== null && value . mapping !== MAPPING . VALUE ) { throw new Error ( ` ` ) ; } const _bypasses = this . cy . data ( '_bypasses' ) || { } ; const ids = eles . map ( ele => ele . id ( ) ) ; if ( value === null ) ids . forEach ( id => _ . unset ( _bypasses , [ id , property ] ) ) ; else ids . forEach ( id => _ . set ( _bypasses , [ id , property ] , value ) ) ; this . cy . data ( { _bypasses } ) ; this . cy . emit ( 'vmbypass' , eles , property , value ) ; } else { const ele = eles ; assertElesNonempty ( ele ) ; assertPropertyIsSupported ( property ) ; const _bypasses = this . cy . data ( '_bypasses' ) || { } ; const ret = [ ] ; const ids = eles . slice ( 0 , 5 ) . map ( ele => ele . id ( ) ) ; ids . forEach ( id => { const styleVal = _ . get ( _bypasses , [ id , property , 'value' ] ) || 'unset' ; const existing = ret . find ( e => e . styleVal == styleVal ) ; if ( existing ) { existing . ids . push ( id ) ; } else { ret . push ( { styleVal , ids : [ id ] } ) ; } } ) ; ret . sort ( ( s1 , s2 ) => s1 . ids . length - s2 . ids . length ) ; return ret ; } }
Set or get the global node style for a property
 @param {Cytoscape.Collection} eles The elements to be set or gotten (must be one element for getting)
 @param {String} property The property name
 @param {StyleStruct} [value] When specified, the bypass is set to this value.
Set or get the global node style for a property @param { Cytoscape . Collection } eles The elements to be set or gotten ( must be one element for getting ) @param { String } property The property name @param { StyleStruct } [ value ] When specified the bypass is set to this value .
// store synched data // assertIsSingleEle(ele); // [{value:{r:1,g:1,b:1}, ids:['id1', 'id2']}];