This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: export types and utilities statically (#1908)
Allows users to access these additional types and utilities without having to create an instance first. BREAKING CHANGE: `ipfs.util.isIPFS` and `ipfs.util.crypto` have moved to static exports and should be accessed via `const { isIPFS, crypto } = require('ipfs')`. The modules available under `ipfs.types.*` have also become static exports. License: MIT Signed-off-by: Alan Shaw <[email protected]>
- Loading branch information
Alan Shaw
authored
Mar 6, 2019
1 parent
503e5ac
commit 79d7fef
Showing
8 changed files
with
60 additions
and
58 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* eslint-env mocha */ | ||
'use strict' | ||
|
||
const crypto = require('libp2p-crypto') | ||
const isIPFS = require('is-ipfs') | ||
const CID = require('cids') | ||
const multiaddr = require('multiaddr') | ||
const multibase = require('multibase') | ||
const multihash = require('multihashes') | ||
const PeerId = require('peer-id') | ||
const PeerInfo = require('peer-info') | ||
const chai = require('chai') | ||
const dirtyChai = require('dirty-chai') | ||
const expect = chai.expect | ||
chai.use(dirtyChai) | ||
|
||
const Ipfs = require('../../') | ||
|
||
describe('exports', () => { | ||
it('should export the expected types and utilities', () => { | ||
expect(Ipfs.crypto).to.equal(crypto) | ||
expect(Ipfs.isIPFS).to.equal(isIPFS) | ||
expect(Ipfs.Buffer).to.equal(Buffer) | ||
expect(Ipfs.CID).to.equal(CID) | ||
expect(Ipfs.multiaddr).to.equal(multiaddr) | ||
expect(Ipfs.multibase).to.equal(multibase) | ||
expect(Ipfs.multihash).to.equal(multihash) | ||
expect(Ipfs.PeerId).to.equal(PeerId) | ||
expect(Ipfs.PeerInfo).to.equal(PeerInfo) | ||
}) | ||
}) |
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