aboutsummaryrefslogtreecommitdiff
path: root/src/gleam_stdlib.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'src/gleam_stdlib.mjs')
-rw-r--r--src/gleam_stdlib.mjs49
1 files changed, 0 insertions, 49 deletions
diff --git a/src/gleam_stdlib.mjs b/src/gleam_stdlib.mjs
index 339963b..e7088b4 100644
--- a/src/gleam_stdlib.mjs
+++ b/src/gleam_stdlib.mjs
@@ -10,10 +10,6 @@ import {
NonEmpty,
CustomType,
} from "./gleam.mjs";
-import {
- CompileError as RegexCompileError,
- Match as RegexMatch,
-} from "./gleam/regex.mjs";
import { DecodeError } from "./gleam/dynamic.mjs";
import { Some, None } from "./gleam/option.mjs";
import { Eq, Gt, Lt } from "./gleam/order.mjs";
@@ -448,51 +444,6 @@ export function utf_codepoint_to_int(utf_codepoint) {
return utf_codepoint.value;
}
-export function regex_check(regex, string) {
- regex.lastIndex = 0;
- return regex.test(string);
-}
-
-export function compile_regex(pattern, options) {
- try {
- let flags = "gu";
- if (options.case_insensitive) flags += "i";
- if (options.multi_line) flags += "m";
- return new Ok(new RegExp(pattern, flags));
- } catch (error) {
- const number = (error.columnNumber || 0) | 0;
- return new Error(new RegexCompileError(error.message, number));
- }
-}
-
-export function regex_split(regex, string) {
- return List.fromArray(
- string.split(regex).map((item) => (item === undefined ? "" : item)),
- );
-}
-
-export function regex_scan(regex, string) {
- const matches = Array.from(string.matchAll(regex)).map((match) => {
- const content = match[0];
- const submatches = [];
- for (let n = match.length - 1; n > 0; n--) {
- if (match[n]) {
- submatches[n - 1] = new Some(match[n]);
- continue;
- }
- if (submatches.length > 0) {
- submatches[n - 1] = new None();
- }
- }
- return new RegexMatch(content, List.fromArray(submatches));
- });
- return List.fromArray(matches);
-}
-
-export function regex_replace(regex, original_string, replacement) {
- return original_string.replaceAll(regex, replacement);
-}
-
export function new_map() {
return Dict.new();
}