Skip to content

Commit

Permalink
Merge pull request #237 from swaldmann/array-isarray
Browse files Browse the repository at this point in the history
Use `Array.isArray` instead of `util.isArray`
  • Loading branch information
jeffalbion authored Sep 27, 2024
2 parents f908e79 + eb0db02 commit 23a73cf
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/protocol/Connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ Connection.prototype.connect = function connect(options, cb) {
if (err) {
return cb(err);
}
if (util.isArray(reply.connectOptions)) {
if (Array.isArray(reply.connectOptions)) {
self.connectOptions.setOptions(reply.connectOptions);
}
manager.finalize(reply.authentication);
Expand Down
2 changes: 1 addition & 1 deletion lib/protocol/MessageBuffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ MessageBuffer.prototype.push = function push(chunk) {
};

MessageBuffer.prototype.getData = function getData() {
if (util.isArray(this.data)) {
if (Array.isArray(this.data)) {
return Buffer.concat(this.data, this.length);
}
return this.data;
Expand Down
4 changes: 2 additions & 2 deletions lib/protocol/Statement.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Statement.prototype.drop = function drop(cb) {
};

Statement.prototype.getParameterName = function getParameterName(i) {
if (util.isArray(this.parameterMetadata) && i < this.parameterMetadata.length) {
if (Array.isArray(this.parameterMetadata) && i < this.parameterMetadata.length) {
return this.parameterMetadata[i].name;
}
};
Expand All @@ -84,7 +84,7 @@ Statement.prototype.handle = function handle(err, reply, cb) {

this.id = reply.statementId;
this.functionCode = reply.functionCode;
if (util.isArray(reply.resultSets) && reply.resultSets.length) {
if (Array.isArray(reply.resultSets) && reply.resultSets.length) {
this.resultSetMetadata = reply.resultSets[0].metadata;
}
this.parameterMetadata = reply.parameterMetadata;
Expand Down
2 changes: 1 addition & 1 deletion lib/protocol/Stringifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function Stringifier(options) {
}

Stringifier.prototype._transform = function _transform(thing, encoding, done) {
if (util.isArray(thing) && thing.length) {
if (Array.isArray(thing) && thing.length) {
this.push(this.transformRows(thing));
} else {
this.push(this.transformRow(thing));
Expand Down
5 changes: 2 additions & 3 deletions lib/protocol/data/Fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
'use strict';

const common = require('../../protocol/common');
var util = require('../../util');

exports.read = read;
exports.write = write;
Expand Down Expand Up @@ -81,7 +80,7 @@ function write(part, fields) {
field = fields[i];
if (Buffer.isBuffer(field)) {
data = field;
} else if (util.isArray(field)) {
} else if (Array.isArray(field)) {
data = write({}, field).buffer;
} else {
data = new Buffer(field, 'ascii');
Expand Down Expand Up @@ -133,7 +132,7 @@ function getArgumentCount(fields) {
function getByteLengthOfField(field) {
if (Buffer.isBuffer(field)) {
return field.length;
} else if (util.isArray(field)) {
} else if (Array.isArray(field)) {
return getByteLength(field);
}
return Buffer.byteLength(field, 'ascii');
Expand Down
2 changes: 1 addition & 1 deletion lib/protocol/part/AbstractOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ AbstractOptions.prototype.getOptions = function getOptions() {
AbstractOptions.prototype.setOptions = function setOptions(options) {
var self = this;

if (!util.isArray(options)) {
if (!Array.isArray(options)) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/protocol/reply/Segment.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ Reply.prototype.add = function add(part) {
this.addResultSetFragment(name, value);
} else if (util.isUndefined(this[name])) {
this[name] = value;
} else if (util.isArray(this[name])) {
} else if (Array.isArray(this[name])) {
this[name].push(value);
} else {
var existingValue = this[name];
Expand Down
2 changes: 1 addition & 1 deletion lib/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ function proxyEvents(source, target, events) {
exports.proxyEvents = proxyEvents;

function createReadStream(ds, events, options) {
if (!util.isArray(events)) {
if (!Array.isArray(events)) {
options = events;
events = ['error', 'close'];
}
Expand Down

0 comments on commit 23a73cf

Please sign in to comment.