Skip to content
This repository was archived by the owner on Dec 6, 2022. It is now read-only.

Commit 958cd09

Browse files
fsdiogodaviddias
authored andcommitted
feat: use class-is module for type checks
1 parent 888d418 commit 958cd09

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
"chai": "^4.1.2"
4242
},
4343
"dependencies": {
44-
"cids": "^0.5.2"
44+
"cids": "^0.5.3",
45+
"class-is": "^1.1.0"
4546
},
4647
"engines": {
4748
"node": ">=6.0.0",

src/index.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict'
22

33
const CID = require('cids')
4+
const withIs = require('class-is')
45

56
/**
67
* Represents an immutable block of data that is uniquely referenced with a cid.
@@ -51,16 +52,6 @@ class Block {
5152
set cid (val) {
5253
throw new Error('Tried to change an immutable block')
5354
}
54-
55-
/**
56-
* Check if the given value is a Block.
57-
*
58-
* @param {any} other
59-
* @returns {bool}
60-
*/
61-
static isBlock (other) {
62-
return other && other.constructor.name === 'Block'
63-
}
6455
}
6556

66-
module.exports = Block
57+
module.exports = withIs(Block, { className: 'Block', symbolName: '@ipfs/js-ipfs-block/block' })

0 commit comments

Comments
 (0)