Skip to content

Commit

Permalink
Code style tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
patriksimek committed Jul 4, 2018
1 parent 9c64d84 commit 18e020f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
4 changes: 2 additions & 2 deletions lib/msnodesqlv8.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const UDT = require('./udt').PARSERS
const DECLARATIONS = require('./datatypes').DECLARATIONS
const ISOLATION_LEVEL = require('./isolationlevel')

const EMPTY_BUFFER = new Buffer(0)
const EMPTY_BUFFER = Buffer.alloc(0)
const JSON_COLUMN_ID = 'JSON_F52E2B61-18A1-11d1-B105-00805F49916B'
const XML_COLUMN_ID = 'XML_F52E2B61-18A1-11d1-B105-00805F49916B'

Expand Down Expand Up @@ -81,7 +81,7 @@ const castParameter = function (value, type) {
case TYPES.VarBinary:
case TYPES.Image:
if (!(value instanceof Buffer)) {
value = new Buffer(value.toString())
value = Buffer.from(value.toString())
}
break
case TYPES.TVP:
Expand Down
18 changes: 2 additions & 16 deletions test/common/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ module.exports = (sql, driver) => {
},

'binary data' (done) {
const sample = new Buffer([0x00, 0x01, 0xe2, 0x40])
const sample = Buffer.from([0x00, 0x01, 0xe2, 0x40])

const req = new TestRequest()
req.input('in', sql.Binary, sample)
Expand Down Expand Up @@ -231,20 +231,6 @@ module.exports = (sql, driver) => {
}).catch(done)
},

'domain' (done) {
let d = require('domain').create()
d.run(function () {
const req = new TestRequest()
let domain = process.domain

req.query('', function (err, recordset) {
assert.strictEqual(domain, process.domain)

done(err)
})
})
},

'empty query' (done) {
const req = new TestRequest()
req.query('').then(result => {
Expand Down Expand Up @@ -290,7 +276,7 @@ module.exports = (sql, driver) => {
},

'query with input parameters' (mode, done) {
const buff = new Buffer([0x00, 0x01, 0xe2, 0x40])
const buff = Buffer.from([0x00, 0x01, 0xe2, 0x40])

const req = new sql.Request()
req.input('id', 12)
Expand Down

0 comments on commit 18e020f

Please sign in to comment.