src/types/treedoc.js
function newPosId (p, f) {
  const pPath = p && p[0]
  const fPath = f && f[0]
  let path
  let uid
  if (pPath && fPath && isSibling(pPath, fPath)) {
    path = [pPath[0], pPath[1]]
    if (f[1].length > p[1].length) {
      const difference = f[1].substring(p[1].length)
      uid = p[1] + halfOf(difference) + cuid()
    } else {
      uid = p[1] + cuid()
    }
  } else {
    path = newPath(pPath, fPath)
    uid = cuid()
  }

  return [path, uid]
}
function newPosId (p, f) {
  const pPath = p && p[0]
  const fPath = f && f[0]
  let path
  let uid
  if (pPath && fPath && isSibling(pPath, fPath)) {
    path = [pPath[0], pPath[1]]
    if (f[1].length > p[1].length) {
      const difference = f[1].substring(p[1].length)
      uid = p[1] + halfOf(difference) + cuid()
    } else {
      uid = p[1] + cuid()
    }
  } else {
    path = newPath(pPath, fPath)
    uid = cuid()
  }

  return [path, uid]
}
function newPosId ( p , f ) { const pPath = p && p [ 0 ] const fPath = f && f [ 0 ] let path let uid if ( pPath && fPath && isSibling ( pPath , fPath ) ) { path = [ pPath [ 0 ] , pPath [ 1 ] ] if ( f [ 1 ] . length > p [ 1 ] . length ) { const difference = f [ 1 ] . substring ( p [ 1 ] . length ) uid = p [ 1 ] + halfOf ( difference ) + cuid ( ) } else { uid = p [ 1 ] + cuid ( ) } } else { path = newPath ( pPath , fPath ) uid = cuid ( ) } return [ path , uid ] }
PosIds and Paths
PosIds and Paths