Skip to content

Commit

Permalink
[refactor] Remove useless variable (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
darrachequesne authored Dec 17, 2016
1 parent aed8257 commit c2d0a08
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ Encoder.prototype.encode = function(obj, callback){

function encodeAsString(obj) {
var str = '';
var nsp = false;

// first is type
str += obj.type;
Expand All @@ -159,22 +158,17 @@ function encodeAsString(obj) {
// if we have a namespace other than `/`
// we append it followed by a comma `,`
if (obj.nsp && '/' !== obj.nsp) {
nsp = true;
str += obj.nsp;
str += ',';
}

// immediately followed by the id
if (null != obj.id) {
if (nsp) {
str += ',';
nsp = false;
}
str += obj.id;
}

// json data
if (null != obj.data) {
if (nsp) str += ',';
str += json.stringify(obj.data);
}

Expand Down

0 comments on commit c2d0a08

Please # to comment.