Skip to content

Commit

Permalink
fix(Buffer): Handle "empty" parts in appendf
Browse files Browse the repository at this point in the history
- Makes it possible to pass an empty target as described in #38 without causing syntax errors.
  • Loading branch information
karfau committed Jun 19, 2020
1 parent c048dc5 commit e268ddb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ class Buffer {
value.replace(/[\(\)]/g, '').replace(/-/g, '_');

const value = strings
.map((str, i) => str + sanitize(values[i]))
.map((str, i) => {
const sanitized = sanitize(values[i]);
return sanitized ? str + sanitized : sanitized
})
.join('');

this.append(value);
Expand Down

0 comments on commit e268ddb

Please sign in to comment.