// Generated by bynkc — do not edit by hand.
// commons text

import { Ok, Err, Some, None, type Result, type Option, type ValidationError } from "./runtime.js";

export function firstWord(s: string): string {
  return ((__o: Option<string>, __d: string) => __o.tag === "Some" ? __o.value : __d)(((__xs: readonly string[], __i: number) => __i >= 0 && __i < __xs.length ? Some(__xs[__i] as string) : None)(s.split(" "), 0), "");
}

export function shout(s: string): string {
  return s.trim().toUpperCase().concat("!");
}

export function redact(s: string, secret: string): string {
  return s.replaceAll(secret, "***");
}

export function initials(s: string): readonly string[] {
  return [...s];
}

export function middle(s: string): string {
  return s.slice(Math.max(0, 1), Math.max(0, (s).length - 1));
}

export function findIn(s: string, sub: string): Option<number> {
  return ((__i: number) => __i < 0 ? None : Some(__i))(s.indexOf(sub));
}

export function checks(s: string): boolean {
  return s.includes("a") && s.startsWith("b") && s.endsWith("c") && s.toLowerCase() === s;
}

