src/iteration/edges.js
function forEachEdge(graph, type, callback) {
  if (graph.size === 0)
    return;

  if (type === 'mixed' || type === graph.type) {
    graph._edges.forEach((data, key) => {

      const {attributes, source, target} = data;

      callback(
        key,
        attributes,
        source.key,
        target.key,
        source.attributes,
        target.attributes
      );
    });
  }
  else {
    const mask = type === 'undirected';

    graph._edges.forEach((data, key) => {
      if ((data instanceof UndirectedEdgeData) === mask) {

        const {attributes, source, target} = data;

        callback(
          key,
          attributes,
          source.key,
          target.key,
          source.attributes,
          target.attributes
        );
      }
    });
  }
}
function forEachEdge(graph, type, callback) {
  if (graph.size === 0)
    return;

  if (type === 'mixed' || type === graph.type) {
    graph._edges.forEach((data, key) => {

      const {attributes, source, target} = data;

      callback(
        key,
        attributes,
        source.key,
        target.key,
        source.attributes,
        target.attributes
      );
    });
  }
  else {
    const mask = type === 'undirected';

    graph._edges.forEach((data, key) => {
      if ((data instanceof UndirectedEdgeData) === mask) {

        const {attributes, source, target} = data;

        callback(
          key,
          attributes,
          source.key,
          target.key,
          source.attributes,
          target.attributes
        );
      }
    });
  }
}
function forEachEdge ( graph , type , callback ) { if ( graph . size === 0 ) return ; if ( type === 'mixed' || type === graph . type ) { graph . _edges . forEach ( ( data , key ) => { const { attributes , source , target } = data ; callback ( key , attributes , source . key , target . key , source . attributes , target . attributes ) ; } ) ; } else { const mask = type === 'undirected' ; graph . _edges . forEach ( ( data , key ) => { if ( ( data instanceof UndirectedEdgeData ) === mask ) { const { attributes , source , target } = data ; callback ( key , attributes , source . key , target . key , source . attributes , target . attributes ) ; } } ) ; } }
Function iterating over a graph's edges using a callback.

@param  {Graph}    graph    - Target Graph instance.
@param  {string}   type     - Type of edges to retrieve.
@param  {function} callback - Function to call.
Function iterating over a graph s edges using a callback .