Skip to content

Commit

Permalink
chore: appease linter
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Alan Shaw <[email protected]>
  • Loading branch information
Alan Shaw committed Sep 13, 2018
1 parent 696afc8 commit 7d19587
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,14 @@ function replacer (cid, base, options) {
? cid.toBaseEncodedString(base).slice(1)
: multibase.encode(base, cid.buffer).toString().slice(1)
case 'P': // prefix
const { name, length } = multihash.decode(cid.multihash)
return `cidv${cid.version}-${cid.codec}-${name}-${length}`
return prefix(cid)
default:
throw new Error(`unrecognized specifier in format string: ${specifier}`)
}
}
}

function prefix (cid) {
const { name, length } = multihash.decode(cid.multihash)
return `cidv${cid.version}-${cid.codec}-${name}-${length}`
}

0 comments on commit 7d19587

Please sign in to comment.