{
  "version": 3,
  "sources": ["../Source/String/index.ts", "../Source/String/String.ts"],
  "sourcesContent": ["/**\n * Utilities for working with `string`s.\n *\n * @module @sorrell/utilities/string\n */\n/**\n * @file      index.ts\n * @author    Gage Sorrell <gage@sorrell.sh>\n * @copyright (c) 2026 Gage Sorrell\n * @license   MIT\n */\nexport * from \"./String.ts\";\n", "/**\n * @file      String.ts\n * @author    Gage Sorrell <gage@sorrell.sh>\n * @copyright (c) 2026 Gage Sorrell\n * @license   MIT\n */\nimport { dfs } from \"effect/Graph\";\nimport { FilterDefined } from \"../Array\";\n/**\n * @module String\n * Functions for manipulating strings.\n */\n// @TODO TEMPORARY.\n/* eslint-disable jsdoc/require-example */\n/**\n * Does the given {@link TestString} contain only letters?\n * This is equivalent to Python's\n * {@link https://docs.python.org/3/library/stdtypes.html#str.isalpha | isalpha} function.\n *\n * @remarks This is an alias for {@link IsAlpha}.\n *\n * @param TestString - The string that you wish to test.\n *\n * @returns {boolean} Whether the given string contains *only* (Latin alphabet) letters.\n */\nexport function IsLetters(TestString: string): boolean {\n    return /^[a-zA-Z]*$/.test(TestString);\n}\n/**\n * Does the given {@link TestString} contain only letters?\n * This is equivalent to Python's\n * {@link https://docs.python.org/3/library/stdtypes.html#str.isalpha | isalpha} function.\n *\n * @param TestString - The string that you wish to test.\n *\n * @returns {boolean} Whether the given string contains *only* (Latin alphabet) letters.\n */\nexport function IsAlpha(TestString: string): boolean {\n    return IsLetters(TestString);\n}\n/**\n * Does the given {@link TestString} contain only digits?\n *\n * This is equivalent to Python's\n * {@link https://docs.python.org/3/library/stdtypes.html#str.isnumeric | isnumeric} function.\n *\n * @param TestString - The string that you wish to test.\n *\n * @returns {boolean} Whether the given string contains *only* numeric digits.\n */\nexport function IsNumeric(TestString: string): boolean {\n    return /^\\d+$/.test(TestString);\n}\n/**\n * This function provides a convenient way to define long strings across multiple lines.\n * The linebreaks and leading indentation are removed from the final string.\n * Please see the example below for how this is to be done.\n *\n * @param Content - The given string to dedent.\n * @param IndentLength - The number of spaces for which this function will check.  This\n * is necessary only if the number of spaces used in the {@link Content} is not a multiple\n * of two.\n *\n * @returns {string} The given {@link Content}, but with the spaces at the beginning\n * of each line (excluding the first line if no spaces exist in the first line) removed.\n *\n * @example\n * ```typescript\n * import { Dedent } from \"@sorrell/utilities/string\";\n *\n * const MyLongString: string = Dedent(`Lorem ipsum dolor sit amet, consectetur adipiscing elit,\n *             sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad\n *                 minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea\n *             commodo consequat.`);\n *\n * // `MyLongString` <- `\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, \\\n * sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad \\\n *     minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea \\\n * commodo consequat.\"`\n * ```\n */\nexport function Dedent(Content: string, IndentLength?: number): string {\n    const WhitespaceSubstring: string = ((): string => {\n        if (IndentLength !== undefined) {\n            return \"\\n\" + \" \".repeat(IndentLength);\n        }\n        let WhitespaceSubstring: string = \"\\n\";\n        while (true) {\n            const TestString: string = WhitespaceSubstring + \"  \";\n            if (Content.includes(TestString)) {\n                WhitespaceSubstring = TestString;\n            }\n            else {\n                break;\n            }\n        }\n        return WhitespaceSubstring;\n    })();\n    return Content.replaceAll(WhitespaceSubstring, \"\");\n}\n/**\n * Given a {@link ReadonlyArray} of `string`s (and possibly `undefined`), join the `string`s\n * with a given {@link Separator} `string`.\n *\n * @param StringArray - The {@link ReadonlyArray} of `string`s, and possibly `undefined`.\n * @param Separator - The `string` passed to {@link Array.join} on the filtered {@link StringArray}.\n *\n * @returns {string} The joined `string`s in the given {@link StringArray}, separated by\n * the given {@link Separator}.\n */\nexport function JoinDefined<ElementType extends string | undefined>(StringArray: ReadonlyArray<ElementType>, Separator: string): string {\n    const IsDefined = <Type>(Element: Type): boolean => Element !== undefined;\n    const DefinedOnly: ReadonlyArray<string> = StringArray.filter(IsDefined) as ReadonlyArray<string>;\n    return DefinedOnly.join(Separator);\n}\nexport function GetUtf8ByteLength(Text: string): number {\n    return new TextEncoder().encode(Text).length;\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACyBO,SAAS,UAAU,YAA6B;AACnD,SAAO,cAAc,KAAK,UAAU;AACxC;AAUO,SAAS,QAAQ,YAA6B;AACjD,SAAO,UAAU,UAAU;AAC/B;AAWO,SAAS,UAAU,YAA6B;AACnD,SAAO,QAAQ,KAAK,UAAU;AAClC;AA6BO,SAAS,OAAO,SAAiB,cAA+B;AACnE,QAAM,uBAA+B,MAAc;AAC/C,QAAI,iBAAiB,QAAW;AAC5B,aAAO,OAAO,IAAI,OAAO,YAAY;AAAA,IACzC;AACA,QAAIA,uBAA8B;AAClC,WAAO,MAAM;AACT,YAAM,aAAqBA,uBAAsB;AACjD,UAAI,QAAQ,SAAS,UAAU,GAAG;AAC9B,QAAAA,uBAAsB;AAAA,MAC1B,OACK;AACD;AAAA,MACJ;AAAA,IACJ;AACA,WAAOA;AAAA,EACX,GAAG;AACH,SAAO,QAAQ,WAAW,qBAAqB,EAAE;AACrD;AAWO,SAAS,YAAoD,aAAyC,WAA2B;AACpI,QAAM,YAAY,CAAO,YAA2B,YAAY;AAChE,QAAM,cAAqC,YAAY,OAAO,SAAS;AACvE,SAAO,YAAY,KAAK,SAAS;AACrC;AACO,SAAS,kBAAkB,MAAsB;AACpD,SAAO,IAAI,YAAY,EAAE,OAAO,IAAI,EAAE;AAC1C;",
  "names": ["WhitespaceSubstring"]
}
