Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/type-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@ TypeObject.prototype.writeBytes = function (bytes, useWordLength) {

// Write the `string` value given as argument
TypeObject.prototype.writeString = function (str) {
try {
return this.writeBytes(Buffer.from(str));
} catch (err) {
return this.writeBytes(str);
}
};

// Write the `byte[]` value given as argument
Expand Down Expand Up @@ -312,4 +316,4 @@ TypeObject.prototype.toPrintable = function (exclude, noColor) {
};

// Export the class
module.exports = exports = TypeObject;
module.exports = exports = TypeObject;