This repository has been archived by the owner on Aug 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: If link hashes to serializer are base58 encoded, then decode th…
…em [Fi… (#43) * If link hashes to serializer are base58 encoded, then decode them [Fixes #28] * Add test
- Loading branch information
1 parent
3062b11
commit 9f66bca
Showing
5 changed files
with
64 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict' | ||
|
||
const DAGLink = require('./index') | ||
|
||
function isDagLink (link) { | ||
return link && link.constructor && link.constructor.name === 'DAGLink' | ||
} | ||
|
||
function createDagLinkFromB58EncodedHash (link) { | ||
return new DAGLink( | ||
link.name ? link.name : link.Name, | ||
link.size ? link.size : link.Size, | ||
link.hash || link.Hash || link.multihash | ||
) | ||
} | ||
|
||
exports = module.exports | ||
exports.isDagLink = isDagLink | ||
exports.createDagLinkFromB58EncodedHash = createDagLinkFromB58EncodedHash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters