aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gleam/bit_builder.gleam7
-rw-r--r--src/gleam/string_builder.gleam7
2 files changed, 14 insertions, 0 deletions
diff --git a/src/gleam/bit_builder.gleam b/src/gleam/bit_builder.gleam
index 90f8866..14c197e 100644
--- a/src/gleam/bit_builder.gleam
+++ b/src/gleam/bit_builder.gleam
@@ -28,6 +28,13 @@ if javascript {
}
}
+/// Create an empty `BitBuilder`. Useful as the start of a pipe chaning many
+/// builders together.
+///
+pub fn new () -> BitBuilder {
+ do_concat([])
+}
+
/// Prepends a bit string to the start of a builder.
///
/// Runs in constant time.
diff --git a/src/gleam/string_builder.gleam b/src/gleam/string_builder.gleam
index dc3ad23..26b7697 100644
--- a/src/gleam/string_builder.gleam
+++ b/src/gleam/string_builder.gleam
@@ -14,6 +14,13 @@
///
pub external type StringBuilder
+/// Create an empty `StringBuilder`. Useful as the start of a pipe chaning many
+/// builders together.
+///
+pub fn new() -> StringBuilder {
+ do_from_strings([])
+}
+
/// Prepends a `String` onto the start of some `StringBuilder`.
///
/// Runs in constant time.