aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiacomo Cavalieri <giacomo.cavalieri@icloud.com>2024-10-10 13:21:45 +0200
committerLouis Pilfold <louis@lpil.uk>2024-10-10 15:06:25 +0100
commitb92a4496767bd1a890ffdd0a922e8f449a4d2dad (patch)
tree828af4d73f00b8c4e9733f304ed9fea7c273c82b
parente633c8097059705e3a67c3f56763f794a22b8b3e (diff)
downloadgleam_stdlib-b92a4496767bd1a890ffdd0a922e8f449a4d2dad.tar.gz
gleam_stdlib-b92a4496767bd1a890ffdd0a922e8f449a4d2dad.zip
refactor regex
-rw-r--r--src/gleam/regex.gleam15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/gleam/regex.gleam b/src/gleam/regex.gleam
index d1f8ef0..b3d1273 100644
--- a/src/gleam/regex.gleam
+++ b/src/gleam/regex.gleam
@@ -61,7 +61,10 @@ pub fn compile(
@external(erlang, "gleam_stdlib", "compile_regex")
@external(javascript, "../gleam_stdlib.mjs", "compile_regex")
-fn do_compile(a: String, with with: Options) -> Result(Regex, CompileError)
+fn do_compile(
+ pattern: String,
+ with with: Options,
+) -> Result(Regex, CompileError)
/// Creates a new `Regex`.
///
@@ -105,13 +108,13 @@ pub fn from_string(pattern: String) -> Result(Regex, CompileError) {
/// // -> False
/// ```
///
-pub fn check(with regex: Regex, content content: String) -> Bool {
- do_check(regex, content)
+pub fn check(with regex: Regex, content string: String) -> Bool {
+ do_check(regex, string)
}
@external(erlang, "gleam_stdlib", "regex_check")
@external(javascript, "../gleam_stdlib.mjs", "regex_check")
-fn do_check(a: Regex, b: String) -> Bool
+fn do_check(regex: Regex, string: String) -> Bool
/// Splits a string.
///
@@ -129,7 +132,7 @@ pub fn split(with regex: Regex, content string: String) -> List(String) {
@external(erlang, "gleam_stdlib", "regex_split")
@external(javascript, "../gleam_stdlib.mjs", "regex_split")
-fn do_split(a: Regex, b: String) -> List(String)
+fn do_split(regex: Regex, string: String) -> List(String)
/// Collects all matches of the regular expression.
///
@@ -189,7 +192,7 @@ pub fn scan(with regex: Regex, content string: String) -> List(Match) {
@external(erlang, "gleam_stdlib", "regex_scan")
@external(javascript, "../gleam_stdlib.mjs", "regex_scan")
-fn do_scan(a: Regex, b: String) -> List(Match)
+fn do_scan(regex: Regex, string: String) -> List(Match)
/// Creates a new `String` by replacing all substrings that match the regular
/// expression.