Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
fix: remove use of assert module (#18)
Browse files Browse the repository at this point in the history
The polyfill is big, we can simulate it by throwing an Error and it doesn't work under React Native.
  • Loading branch information
achingbrain authored Feb 13, 2020
1 parent 9fa19ab commit 57e24a7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/record.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict'

const protons = require('protons')
const assert = require('assert')

const pb = protons(require('./record.proto')).Record
const utils = require('./utils')
Expand All @@ -13,12 +12,12 @@ class Record {
* @param {Date} [recvtime]
*/
constructor (key, value, recvtime) {
if (key) {
assert(Buffer.isBuffer(key), 'key must be a Buffer')
if (key && !Buffer.isBuffer(key)) {
throw new Error('key must be a Buffer')
}

if (value) {
assert(Buffer.isBuffer(value), 'value must be a buffer')
if (value && !Buffer.isBuffer(value)) {
throw new Error('value must be a buffer')
}

this.key = key
Expand Down

0 comments on commit 57e24a7

Please sign in to comment.