Skip to content

Commit c704d63

Browse files
committed
Changeset: Move stringAssembler() logic to a new class
1 parent 0ded191 commit c704d63

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/static/js/Changeset.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -674,14 +674,16 @@ exports.stringIterator = (str) => {
674674
};
675675
};
676676

677+
class StringAssembler {
678+
constructor() { this._str = ''; }
679+
append(x) { this._str += String(x); }
680+
toString() { return this._str; }
681+
}
682+
677683
/**
678684
* A custom made StringBuffer
679685
*/
680-
exports.stringAssembler = () => ({
681-
_str: '',
682-
append(x) { this._str += String(x); },
683-
toString() { return this._str; },
684-
});
686+
exports.stringAssembler = () => new StringAssembler();
685687

686688
/**
687689
* Class to iterate and modify texts which have several lines. It is used for applying Changesets on

0 commit comments

Comments
 (0)