Skip to content

Commit ff8caf5

Browse files
committed
Implement Element#valueOf
Makes it easier to work with package properties
1 parent a87bedd commit ff8caf5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/protocol/elements/Element.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,7 @@ Element.prototype.inspect = function() {
3232
}
3333
return '<' + this.constructor.name + ' ' + Util.inspect(properties) + '>';
3434
};
35+
36+
Element.prototype.valueOf = function() {
37+
return this.value;
38+
};

lib/protocol/sequences/Handshake.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Handshake.prototype._parseInitializationPacket = function(cb) {
3737

3838
Handshake.prototype._handleInitializationPacket = function(packet, cb) {
3939
this.emit('packet', new Packets.ClientAuthenticationPacket({
40-
number : packet.number.value + 1,
40+
number : packet.number + 1,
4141
scrambleBuff : Password.token(this.password, packet.scrambleBuff()),
4242
user : this.user,
4343
databasename : this.database,
@@ -52,7 +52,7 @@ Handshake.prototype._handleInitializationPacket = function(packet, cb) {
5252

5353
Handshake.prototype._handleResultPacket = function(packet, cb) {
5454
if (packet instanceof Packets.ErrorPacket) {
55-
cb(new Error('Handshake.AuthenticationDenied: ' + packet.message.value));
55+
cb(new Error('Handshake.AuthenticationDenied: ' + packet.message));
5656
return;
5757
}
5858

0 commit comments

Comments
 (0)