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

Commit

Permalink
fix: remove buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias committed Apr 23, 2020
1 parent e69a1e2 commit bd6a99f
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"peer-id": "~0.13.6"
},
"dependencies": {
"buffer-split": "^1.0.0",
"buffer": "^5.6.0",
"err-code": "^2.0.0",
"multihashes": "~0.4.15",
"multihashing-async": "^0.8.0",
Expand Down
2 changes: 1 addition & 1 deletion src/record.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

const protons = require('protons')

const { Buffer } = require('buffer')
const pb = protons(require('./record.proto')).Record
const utils = require('./utils')

Expand Down
4 changes: 1 addition & 3 deletions src/selection.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict'

const bsplit = require('buffer-split')
const errcode = require('err-code')

/**
* Select the best record out of the given records.
*
Expand All @@ -18,7 +16,7 @@ const bestRecord = (selectors, k, records) => {
throw errcode(new Error(errMsg), 'ERR_NO_RECORDS_RECEIVED')
}

const parts = bsplit(k, Buffer.from('/'))
const parts = k.toString().split('/')

if (parts.length < 3) {
const errMsg = 'Record key does not have a selector function'
Expand Down
2 changes: 1 addition & 1 deletion src/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const bsplit = require('buffer-split')
const errcode = require('err-code')

const { Buffer } = require('buffer')
/**
* Checks a record and ensures it is still valid.
* It runs the needed validators.
Expand Down
2 changes: 1 addition & 1 deletion src/validators/public-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const multihashing = require('multihashing-async')
const errcode = require('err-code')

const { Buffer } = require('buffer')
/**
* Validator for publick key records.
* Verifies that the passed in record value is the PublicKey
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/go-key-records.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'

const { Buffer } = require('buffer')
module.exports = {
publicKey: Buffer.from(
'CAASXjBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDjXAQQMal4SB2tSnX6NJIPmC69/BT8A8jc7/gDUZNkEhdhYHvc7k7S4vntV/c92nJGxNdop9fKJyevuNMuXhhHAgMBAAE=',
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/go-record.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'

const { Buffer } = require('buffer')
// Fixtures generated using gore (https://github.com/motemen/gore)
//
// :import github.com/libp2p/go-libp2p-record
Expand Down
2 changes: 1 addition & 1 deletion test/record.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
const chai = require('chai')
chai.use(require('dirty-chai'))
const expect = chai.expect

const { Buffer } = require('buffer')
const libp2pRecord = require('../src')
const Record = libp2pRecord.Record

Expand Down
2 changes: 1 addition & 1 deletion test/selection.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'use strict'

var expect = require('chai').expect

const { Buffer } = require('buffer')
const libp2pRecord = require('../src')
const selection = libp2pRecord.selection

Expand Down
2 changes: 1 addition & 1 deletion test/validator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ chai.use(require('dirty-chai'))
const expect = chai.expect
const crypto = require('libp2p-crypto')
const PeerId = require('peer-id')

const { Buffer } = require('buffer')
const libp2pRecord = require('../src')
const validator = libp2pRecord.validator
const Record = libp2pRecord.Record
Expand Down

0 comments on commit bd6a99f

Please sign in to comment.