src/iteration/edges.js
function createEdgeIterator(graph, type) {
  if (graph.size === 0)
    return Iterator.empty();

  let iterator;

  if (type === 'mixed') {
    iterator = graph._edges.values();

    return new Iterator(function next() {
      const step = iterator.next();

      if (step.done)
        return step;

      const data = step.value;

      const value = [
        data.key,
        data.attributes,
        data.source.key,
        data.target.key,
        data.source.attributes,
        data.target.attributes
      ];

      return {value, done: false};
    });
  }

  iterator = graph._edges.values();

  return new Iterator(function next() {
    const step = iterator.next();

    if (step.done)
      return step;

    const data = step.value;

    if ((data instanceof UndirectedEdgeData) === (type === 'undirected')) {
      const value = [
        data.key,
        data.attributes,
        data.source.key,
        data.target.key,
        data.source.attributes,
        data.target.attributes
      ];

      return {value, done: false};
    }

    return next();
  });
}
function createEdgeIterator(graph, type) {
  if (graph.size === 0)
    return Iterator.empty();

  let iterator;

  if (type === 'mixed') {
    iterator = graph._edges.values();

    return new Iterator(function next() {
      const step = iterator.next();

      if (step.done)
        return step;

      const data = step.value;

      const value = [
        data.key,
        data.attributes,
        data.source.key,
        data.target.key,
        data.source.attributes,
        data.target.attributes
      ];

      return {value, done: false};
    });
  }

  iterator = graph._edges.values();

  return new Iterator(function next() {
    const step = iterator.next();

    if (step.done)
      return step;

    const data = step.value;

    if ((data instanceof UndirectedEdgeData) === (type === 'undirected')) {
      const value = [
        data.key,
        data.attributes,
        data.source.key,
        data.target.key,
        data.source.attributes,
        data.target.attributes
      ];

      return {value, done: false};
    }

    return next();
  });
}
function createEdgeIterator ( graph , type ) { if ( graph . size === 0 ) return Iterator . empty ( ) ; let iterator ; if ( type === 'mixed' ) { iterator = graph . _edges . values ( ) ; return new Iterator ( function next ( ) { const step = iterator . next ( ) ; if ( step . done ) return step ; const data = step . value ; const value = [ data . key , data . attributes , data . source . key , data . target . key , data . source . attributes , data . target . attributes ] ; return { value , done : false } ; } ) ; } iterator = graph . _edges . values ( ) ; return new Iterator ( function next ( ) { const step = iterator . next ( ) ; if ( step . done ) return step ; const data = step . value ; if ( ( data instanceof UndirectedEdgeData ) === ( type === 'undirected' ) ) { const value = [ data . key , data . attributes , data . source . key , data . target . key , data . source . attributes , data . target . attributes ] ; return { value , done : false } ; } return next ( ) ; } ) ; }
Function creating an iterator of edges for the given type.

@param  {Graph}    graph - Target Graph instance.
@param  {string}   type  - Type of edges to retrieve.
@return {Iterator}
Function creating an iterator of edges for the given type .