Skip to content

Commit

Permalink
Fix style errors and Buffer deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Dzialocha committed Oct 8, 2017
1 parent 2282742 commit 0ada245
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 14 deletions.
8 changes: 8 additions & 0 deletions .eslintrc
Expand Up @@ -12,6 +12,14 @@
"no-unused-expressions": "off",
"class-methods-use-this": "off",
"no-bitwise": "off",
"function-paren-newline": ["error", "consistent"],
"prefer-destructuring": [
"error",
{
"object": true,
"array": false
}
],
"import/no-extraneous-dependencies": [
"error",
{
Expand Down
2 changes: 1 addition & 1 deletion src/atomic.js
Expand Up @@ -40,7 +40,7 @@ export default class Atomic {
return data
}

/**
/**
* Unpack binary data from DataView according to the given format
* @param {DataView} dataView The DataView holding the binary representation of the value
* @param {string} method The DataView method to read the format from the ArrayBuffer
Expand Down
2 changes: 1 addition & 1 deletion src/message.js
Expand Up @@ -125,7 +125,7 @@ export default class Message {
throw new Error('OSC Message found malformed or missing type string')
}

let offset = types.offset
let { offset } = types
let next
let type

Expand Down
6 changes: 2 additions & 4 deletions src/osc.js
Expand Up @@ -92,11 +92,9 @@ class OSC {
})

// pass EventHandler's notify() to plugin
const eventHandler = this.eventHandler
const { eventHandler } = this
if (this.options.plugin && this.options.plugin.registerNotify) {
this.options.plugin.registerNotify((...args) =>
eventHandler.notify(...args)
)
this.options.plugin.registerNotify((...args) => eventHandler.notify(...args))
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/plugin/bridge.js
Expand Up @@ -208,7 +208,7 @@ export default class BridgePlugin {

if (receiver === 'udp') {
// send data to udp client
const data = binary instanceof Buffer ? binary : new Buffer(binary)
const data = binary instanceof Buffer ? binary : Buffer.from(binary)
this.socket.send(
data,
0,
Expand Down
2 changes: 1 addition & 1 deletion src/plugin/dgram.js
Expand Up @@ -176,6 +176,6 @@ export default class DatagramPlugin {
const options = Object.assign({}, this.options.send, customOptions)
const { port, host } = options

this.socket.send(new Buffer(binary), 0, binary.byteLength, port, host)
this.socket.send(Buffer.from(binary), 0, binary.byteLength, port, host)
}
}
9 changes: 7 additions & 2 deletions test/atomic/blob.spec.js
Expand Up @@ -4,7 +4,10 @@ import AtomicBlob from '../../src/atomic/blob'

/** @test {AtomicBlob} */
describe('AtomicBlob', () => {
const bitArray = { 0: 0, 1: 0, 2: 0, 3: 5, 4: 54, 5: 42, 6: 11, 7: 33, 8: 66, 9: 0, 10: 0, 11: 0 }
const bitArray = {
0: 0, 1: 0, 2: 0, 3: 5, 4: 54, 5: 42, 6: 11, 7: 33, 8: 66, 9: 0, 10: 0, 11: 0,
}

let atomic

before(() => {
Expand Down Expand Up @@ -50,7 +53,9 @@ describe('AtomicBlob', () => {

it('sets the value to our blob', () => {
expect(JSON.stringify(atomic.value)).to.equal(
JSON.stringify({ 0: 1, 1: 2, 2: 3, 3: 4, 4: 5, 5: 6, 6: 7 })
JSON.stringify({
0: 1, 1: 2, 2: 3, 3: 4, 4: 5, 5: 6, 6: 7,
})
)
})
})
Expand Down
7 changes: 5 additions & 2 deletions test/atomic/float32.spec.js
Expand Up @@ -2,9 +2,12 @@ import { expect } from 'chai'

import AtomicFloat32 from '../../src/atomic/float32'

/** @test {AtomicFloat32} */
/** @test {AtomicFloat32} */
describe('AtomicFloat32', () => {
const bitArray = { 0: 70, 1: 25, 2: 124, 3: 237 }
const bitArray = {
0: 70, 1: 25, 2: 124, 3: 237,
}

let atomic

before(() => {
Expand Down
5 changes: 4 additions & 1 deletion test/atomic/int32.spec.js
Expand Up @@ -4,7 +4,10 @@ import AtomicInt32 from '../../src/atomic/int32'

/** @test {AtomicInt32} */
describe('AtomicInt32', () => {
const bitArray = { 0: 0, 1: 0, 2: 0, 3: 42 }
const bitArray = {
0: 0, 1: 0, 2: 0, 3: 42,
}

let atomic

before(() => {
Expand Down
5 changes: 4 additions & 1 deletion test/atomic/timetag.spec.js
Expand Up @@ -35,7 +35,10 @@ describe('Timetag', () => {

/** @test {AtomicTimetag} */
describe('AtomicTimetag', () => {
const bitArray = { 0: 0, 1: 1, 2: 248, 3: 99, 4: 0, 5: 4, 6: 84, 7: 63 }
const bitArray = {
0: 0, 1: 1, 2: 248, 3: 99, 4: 0, 5: 4, 6: 84, 7: 63,
}

let atomic

before(() => {
Expand Down

0 comments on commit 0ada245

Please sign in to comment.