Skip to content
This repository has been archived by the owner on Feb 22, 2019. It is now read-only.

Commit

Permalink
Merge pull request #97 from beatlevic/patch-1
Browse files Browse the repository at this point in the history
Update serializers.js
  • Loading branch information
devdazed committed Mar 26, 2013
2 parents 43182ec + 85d924a commit eb5b21e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/marshal/serializers.js
Expand Up @@ -165,7 +165,12 @@ Serializers.encodeDate = function(val){
* @static
*/
Serializers.encodeUUID = function(val){
return val.toBuffer();
if (val instanceof UUID.UUID) {
return val.toBuffer();
} else {
var uuid = new UUID.UUID(val);
return uuid.toBuffer();
}
};

/**
Expand All @@ -175,7 +180,12 @@ Serializers.encodeUUID = function(val){
* @static
*/
Serializers.encodeTimeUUID = function(val){
return val.toBuffer();
if (val instanceof UUID.TimeUUID) {
return val.toBuffer();
} else {
var timeUUID = new UUID.TimeUUID(val);
return timeUUID.toBuffer();
}
};

module.exports = Serializers;

0 comments on commit eb5b21e

Please sign in to comment.