You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.
isCID checks version, codec and multihash properties are present and validates them. This proves that the passed object is an object that looks like { version, codec, multihash } and each property is valid, but doesn't actually prove that the passed object is an instance of CID.
So you could get back a true from isCID but there's a possibility that toBaseEncodedString (and the other instance methods) don't exist!
It's still possible to "fake" a CID instance, but it's much harder to do it by accident and we might even get a performance win if we make version, codec, and multihash readonly, because we can safely assume they are valid if we can determine the passed object is an instance of CID.
The text was updated successfully, but these errors were encountered:
isCID
checksversion
,codec
andmultihash
properties are present and validates them. This proves that the passed object is an object that looks like{ version, codec, multihash }
and each property is valid, but doesn't actually prove that the passed object is an instance ofCID
.So you could get back a
true
fromisCID
but there's a possibility thattoBaseEncodedString
(and the other instance methods) don't exist!I know it's not the perfect solution, but would using https://github.com/moxystudio/js-class-is be better?
It's still possible to "fake" a CID instance, but it's much harder to do it by accident and we might even get a performance win if we make
version
,codec
, andmultihash
readonly, because we can safely assume they are valid if we can determine the passed object is an instance of CID.The text was updated successfully, but these errors were encountered: