An ES/JS Stringbuilder utility
Find a file
2025-07-14 11:12:26 +02:00
Bundle update regexhelper, re-version 2025-07-14 11:12:26 +02:00
Examples Small beer docs 2025-07-10 16:20:42 +02:00
src update regexhelper, re-version 2025-07-14 11:12:26 +02:00
tests update regexphelper/re-version/add test 2025-07-12 15:41:38 +02:00
index.js remove unused 2025-04-22 13:21:49 +02:00
LICENSE Cleaned 2025-04-03 14:06:53 +02:00
package.json update regexhelper, re-version 2025-07-14 11:12:26 +02:00
README.md Readme remove incorrect 2025-07-13 13:28:31 +02:00

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.

js-stringweaver

An ES/JS "stringbuilder" utility module. The module delivers a constructor to create mutable strings.

Highlights

  • 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

Documentation

Demonstration / Documentation. Idem @Github

Install module

Use npm install stringweaver to install the module locally.

Import/use (NodeJS or browser client file)

/* 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!"

Unit testing

Use npm test to run all tests (with coverage report)