Skip to content

Commit b1c2465

Browse files
committed
style: fix all the linting
1 parent 14573a6 commit b1c2465

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

benchmarks/hash.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const algs = [
2727

2828
algs.forEach((alg) => {
2929
suite.add(alg, function (d) {
30-
const buf = new Buffer(10 * 1024)
30+
const buf = Buffer.alloc(10 * 1024)
3131
buf.fill(Math.ceil(Math.random() * 100))
3232

3333
multihashing(buf, alg, (err, res) => {
@@ -40,11 +40,11 @@ algs.forEach((alg) => {
4040
})
4141
})
4242
suite
43-
.on('cycle', (event) => {
44-
console.log(String(event.target))
45-
list = []
46-
})
47-
// run async
48-
.run({
49-
async: true
50-
})
43+
.on('cycle', (event) => {
44+
console.log(String(event.target))
45+
list = []
46+
})
47+
// run async
48+
.run({
49+
async: true
50+
})

example.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict'
22

33
const multihashing = require('multihashing-async')
4-
const buf = new Buffer('beep boop')
4+
const buf = Buffer.from('beep boop')
55

66
function print (err, mh) {
77
if (err) {

src/crypto-sha1-2-browser.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* global self */
2+
13
'use strict'
24

35
const nodeify = require('nodeify')
@@ -24,7 +26,7 @@ function webCryptoHash (type) {
2426

2527
if (typeof res.then !== 'function') { // IE11
2628
res.onerror = () => {
27-
callback(`Error hashing data using ${type}`)
29+
callback(new Error(`hashing data using ${type}`))
2830
}
2931
res.oncomplete = (e) => {
3032
callback(null, e.target.result)
@@ -33,7 +35,7 @@ function webCryptoHash (type) {
3335
}
3436

3537
nodeify(
36-
res.then((raw) => new Buffer(new Uint8Array(raw))),
38+
res.then((raw) => Buffer.from(new Uint8Array(raw))),
3739
callback
3840
)
3941
}

src/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ exports.toCallback = (doWork) => {
2222

2323
exports.toBuf = (doWork, other) => (input) => {
2424
let result = doWork(input, other)
25-
return new Buffer(result, 'hex')
25+
return Buffer.from(result, 'hex')
2626
}
2727

2828
exports.fromString = (doWork, other) => (_input) => {

0 commit comments

Comments
 (0)