This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +1
-30
lines changed Expand file tree Collapse file tree 1 file changed +1
-30
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ const DAGLink = require('ipfs-merkle-dag').DAGLink
5
5
const promisify = require ( 'promisify-es6' )
6
6
const bs58 = require ( 'bs58' )
7
7
const bl = require ( 'bl' )
8
+ const cleanMultihash = require ( '../clean-multihash' )
8
9
9
10
module . exports = ( send ) => {
10
11
const api = {
@@ -316,33 +317,3 @@ module.exports = (send) => {
316
317
317
318
return api
318
319
}
319
-
320
- // TODO verify if this is duplicated of clean-multihash.js
321
- function cleanMultihash ( multihash , options ) {
322
- if ( Buffer . isBuffer ( multihash ) ) {
323
- if ( options . enc ) {
324
- switch ( options . enc ) {
325
- case 'base58' : {
326
- multihash = multihash . toString ( )
327
- break
328
- }
329
- default : throw new Error ( 'invalid multihash' )
330
- }
331
- } else {
332
- multihash = bs58 . encode ( multihash ) . toString ( )
333
- }
334
- } else if ( typeof multihash === 'string' ) {
335
- if ( options . enc ) {
336
- // For the future, when we support more than one enc
337
- // switch (options.enc) {
338
- // case 'base58': // It is good
339
- // }
340
- } else {
341
- throw new Error ( 'not valid multihash' )
342
- }
343
- } else if ( ! multihash ) {
344
- throw new Error ( 'missing valid multihash' )
345
- }
346
-
347
- return multihash
348
- }
You can’t perform that action at this time.
0 commit comments