mirror of
https://github.com/fluencelabs/js-libp2p-crypto
synced 2025-06-27 23:31:34 +00:00
fix: replace node buffers with uint8arrays (#180)
* fix: replace node buffers with uint8arrays All usage of node buffers have been replaced with uint8arrays. BREAKING CHANGES: - Where node Buffers were returned, now Uint8Arrays are * chore: remove commented code
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
/* eslint-env mocha */
|
||||
'use strict'
|
||||
|
||||
const { Buffer } = require('buffer')
|
||||
const uint8ArrayFromString = require('uint8arrays/from-string')
|
||||
const util = require('util')
|
||||
const garbage = [Buffer.from('00010203040506070809', 'hex'), {}, null, false, undefined, true, 1, 0, Buffer.from(''), 'aGVsbG93b3JsZA==', 'helloworld', '']
|
||||
const garbage = [uint8ArrayFromString('00010203040506070809', 'base16'), {}, null, false, undefined, true, 1, 0, uint8ArrayFromString(''), 'aGVsbG93b3JsZA==', 'helloworld', '']
|
||||
|
||||
function doTests (fncName, fnc, num, skipBuffersAndStrings) {
|
||||
if (!num) {
|
||||
@ -11,8 +11,8 @@ function doTests (fncName, fnc, num, skipBuffersAndStrings) {
|
||||
}
|
||||
|
||||
garbage.forEach((garbage) => {
|
||||
if (skipBuffersAndStrings && (Buffer.isBuffer(garbage) || (typeof garbage) === 'string')) {
|
||||
// skip this garbage because it's a buffer or a string and we were told do do that
|
||||
if (skipBuffersAndStrings && (garbage instanceof Uint8Array || (typeof garbage) === 'string')) {
|
||||
// skip this garbage because it's a Uint8Array or a String and we were told do do that
|
||||
return
|
||||
}
|
||||
const args = []
|
||||
|
Reference in New Issue
Block a user