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

Commit

Permalink
feat: use class-is module for type checks
Browse files Browse the repository at this point in the history
  • Loading branch information
fsdiogo authored and daviddias committed Apr 9, 2018
1 parent 888d418 commit 958cd09
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"chai": "^4.1.2"
},
"dependencies": {
"cids": "^0.5.2"
"cids": "^0.5.3",
"class-is": "^1.1.0"
},
"engines": {
"node": ">=6.0.0",
Expand Down
13 changes: 2 additions & 11 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict'

const CID = require('cids')
const withIs = require('class-is')

/**
* Represents an immutable block of data that is uniquely referenced with a cid.
Expand Down Expand Up @@ -51,16 +52,6 @@ class Block {
set cid (val) {
throw new Error('Tried to change an immutable block')
}

/**
* Check if the given value is a Block.
*
* @param {any} other
* @returns {bool}
*/
static isBlock (other) {
return other && other.constructor.name === 'Block'
}
}

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

0 comments on commit 958cd09

Please sign in to comment.