Important
This repository is moved to Codeberg.org.
For now it is kept in sync with the original repository @Github.
Depending on future USA/Microsoft/Github policies the Github version maybe discontinued later.
In other words, starting july 10 2025 the Codeberg repository is authorative.
An ES/JS "stringbuilder" utility module. The module delivers a constructor to create mutable strings.
- small footprint
- extendable with custom getters/methods
- retains history of changes
- no external dependencies
- instances can use and/or chain native String getters/methods (e.g.
replace
,split
,length
) - 100% test coverage
Demonstration / Documentation. Idem @Github
Use npm install stringweaver
to install the module locally.
/* notes:
- make sure the script/node project is of type "module"
- the bundled module can be found @ https://unpkg.com/stringweaver/Bundle/index.min.js
- the module is imported as $S here */
import $S from "[location of index.js or Bundle/index.min.js]";
// assign the symbolic string extension
const SB = Symbol.toSB;
const myBrandNewString = $S`Hello`.append(" world");
const myNextString = "** "[SB].append(myBrandNewString).toUpperCase().append(`!`);
// myBrandNewString => "Hello world"
// myNextString => "** HELLO WORLD!"
Use npm test
to run all tests (with coverage report)