src/dag-node.js
function toProtoBuf (node) {
  const pbn = {}

  if (node.data && node.data.length > 0) {
    pbn.Data = node.data
  } else {
    pbn.Data = null // new Buffer(0)
  }

  if (node.links.length > 0) {
    pbn.Links = node.links.map((link) => {
      return {
        Hash: link.hash,
        Name: link.name,
        Tsize: link.size
      }
    })
  } else {
    pbn.Links = null
  }

  return pbn
}
function toProtoBuf (node) {
  const pbn = {}

  if (node.data && node.data.length > 0) {
    pbn.Data = node.data
  } else {
    pbn.Data = null // new Buffer(0)
  }

  if (node.links.length > 0) {
    pbn.Links = node.links.map((link) => {
      return {
        Hash: link.hash,
        Name: link.name,
        Tsize: link.size
      }
    })
  } else {
    pbn.Links = null
  }

  return pbn
}
function toProtoBuf ( node ) { const pbn = { } if ( node . data && node . data . length > 0 ) { pbn . Data = node . data } else { pbn . Data = null // new Buffer(0) } if ( node . links . length > 0 ) { pbn . Links = node . links . map ( ( link ) => { return { Hash : link . hash , Name : link . name , Tsize : link . size } } ) } else { pbn . Links = null } return pbn }
Helper method to get a protobuf object equivalent
Helper method to get a protobuf object equivalent