-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cast with options, better debug messages
client.cast() takes options as an argument more consistent, verbose, debug messages
- Loading branch information
Brendan Myers
committed
Feb 23, 2017
1 parent
4e1f14b
commit 7a6bac0
Showing
7 changed files
with
114 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
const debug = require('debug')('tibbar:content'); | ||
|
||
export default class Content { | ||
constructor(buffer) { | ||
debug(`.constructor() buffer=${buffer}`); | ||
this._buffer = buffer; | ||
} | ||
|
||
asString() { | ||
debug('.asString()'); | ||
debug(` returning=${this._buffer.toString()}`); | ||
return this._buffer.toString(); | ||
} | ||
|
||
asInt() { | ||
return this._buffer.readInt32BE(); | ||
debug('.asInt()'); | ||
debug(` returning=${this._buffer.readDoubleBE()}`); | ||
return this._buffer.readDoubleBE(); | ||
} | ||
|
||
asJSON() { | ||
debug('.asJSON()'); | ||
debug(` returning=${JSON.asString(this.asString())}`); | ||
return JSON.parse(this.asString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.