Package Exports
- @lazy-ipfs/detect-cid-lib
- @lazy-ipfs/detect-cid-lib/index
- @lazy-ipfs/detect-cid-lib/index.js
- @lazy-ipfs/detect-cid-lib/lib/js-cids
- @lazy-ipfs/detect-cid-lib/lib/js-cids.js
- @lazy-ipfs/detect-cid-lib/lib/js-multiformats
- @lazy-ipfs/detect-cid-lib/lib/js-multiformats.js
- @lazy-ipfs/detect-cid-lib/lib/types
- @lazy-ipfs/detect-cid-lib/lib/types.js
- @lazy-ipfs/detect-cid-lib/lib/util
- @lazy-ipfs/detect-cid-lib/lib/util.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@lazy-ipfs/detect-cid-lib) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
README.md
detect input cid is js-multiformats or js-cid
install
yarn add @lazy-ipfs/detect-cid-lib
yarn-tool add @lazy-ipfs/detect-cid-lib
yt add @lazy-ipfs/detect-cid-lib
import typeofCID, { EnumTypeofCID, isJsCID, isMultiformatsCID } from '@lazy-ipfs/detect-cid-lib';
import JsCID from 'cids';
import { CID as MultiformatsCID } from 'multiformats';
describe(`describe`, () =>
{
test(EnumTypeofCID.js_cid, () =>
{
const cid = new JsCID('bafybeidw5mmxmimpuzo7wiwmhwvea2zalug5djderubacu2aqnneva6zwy');
let actual = typeofCID(cid);
let expected = EnumTypeofCID.js_cid;
console.dir(cid)
expect(cid.multihash).toMatchSnapshot();
expect(cid).toMatchSnapshot();
expect(actual).toStrictEqual(expected);
expect(isJsCID(cid)).toBeTruthy();
});
test(EnumTypeofCID.multiformats_cid, () =>
{
const cid = MultiformatsCID.parse('bafybeidw5mmxmimpuzo7wiwmhwvea2zalug5djderubacu2aqnneva6zwy');
let actual = typeofCID(cid);
let expected = EnumTypeofCID.multiformats_cid;
console.dir(cid)
expect(cid.multihash).toMatchSnapshot();
expect(cid).toMatchSnapshot();
expect(actual).toStrictEqual(expected);
expect(isMultiformatsCID(cid)).toBeTruthy();
});
})