From b92a4496767bd1a890ffdd0a922e8f449a4d2dad Mon Sep 17 00:00:00 2001 From: Giacomo Cavalieri Date: Thu, 10 Oct 2024 13:21:45 +0200 Subject: refactor regex --- src/gleam/regex.gleam | 15 +++++++++------ 1 file 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. -- cgit v1.2.3