Skip to content

Commit

Permalink
do trim on encodingLength as well
Browse files Browse the repository at this point in the history
  • Loading branch information
mafintosh committed May 19, 2021
1 parent c111168 commit 25f15dd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ name.decode.bytes = 0

name.encodingLength = function (n) {
if (n === '.') return 1
return Buffer.byteLength(n) + 2
return Buffer.byteLength(n.replace(/^\.|\.$/gm, '')) + 2
}

const string = {}
Expand Down

0 comments on commit 25f15dd

Please sign in to comment.