{"id":21213025,"url":"https://github.com/dev-ahmadbilal/string-master","last_synced_at":"2025-07-10T09:32:15.372Z","repository":{"id":255931966,"uuid":"852655053","full_name":"dev-ahmadbilal/string-master","owner":"dev-ahmadbilal","description":"A comprehensive JS/TS library with 18 specialized classes for string manipulation, conversion, validation, and more. Streamline your development with powerful, all-in-one solutions.","archived":false,"fork":false,"pushed_at":"2024-09-12T04:44:26.000Z","size":199,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2024-09-12T14:15:56.543Z","etag":null,"topics":["inflection","javascript","slugify","string-case","string-comparison","string-compression","string-distance","string-interpolation","string-manipulation","string-matching","string-methods","string-search","string-similarity","string-transformations","string-utilities","string-validation","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/string-master","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dev-ahmadbilal.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-05T07:27:03.000Z","updated_at":"2024-09-09T10:34:09.000Z","dependencies_parsed_at":"2024-09-12T13:51:32.136Z","dependency_job_id":null,"html_url":"https://github.com/dev-ahmadbilal/string-master","commit_stats":null,"previous_names":["dev-ahmadbilal/string-master"],"tags_count":2,"template":false,"template_full_name":"dev-ahmadbilal/npm-pkg-boilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-ahmadbilal%2Fstring-master","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-ahmadbilal%2Fstring-master/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-ahmadbilal%2Fstring-master/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-ahmadbilal%2Fstring-master/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dev-ahmadbilal","download_url":"https://codeload.github.com/dev-ahmadbilal/string-master/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225629655,"owners_count":17499295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["inflection","javascript","slugify","string-case","string-comparison","string-compression","string-distance","string-interpolation","string-manipulation","string-matching","string-methods","string-search","string-similarity","string-transformations","string-utilities","string-validation","typescript"],"created_at":"2024-11-20T21:12:50.445Z","updated_at":"2024-11-20T21:12:51.058Z","avatar_url":"https://github.com/dev-ahmadbilal.png","language":"TypeScript","readme":"# String Master\n\n[![npm package][npm-img]][npm-url]\n[![Build Status][build-img]][build-url]\n[![Downloads][download-img]][npm-url]\n[![Issues][issues-img]][issues-url]\n[![Code Coverage][codecov-img]][codecov-url]\n[![Semantic Release][semantic-release-img]][semantic-release-url]\n\n`String Master` is a powerful JavaScript/TypeScript library designed to simplify a wide range of string operations and manipulations. With a comprehensive set of utility classes, it provides tools for transforming text, converting between formats, compressing data, encoding and decoding strings, sanitizing input, searching efficiently, and analyzing content. Each utility class is designed to address specific needs, making `String Master` an all-in-one solution for developers handling string data.\n\n## Table of Contents\n\n- [Installation](#1-installation)\n- [Usage](#2-usage)\n  - [CasingMaster](#1-CasingMaster): Convert strings to various cases, like Camel Case, Snake Case, and more.\n  - [ConversionMaster](#2-ConversionMaster): Convert strings between different types, such as hexadecimal, integers, or float.\n  - [EmojiMaster](#4-emojimaster): Manipulate, find, or replace emojis in strings.\n  - [EntropyMaster](#5-entropymaster): Calculate the entropy of a string for cryptographic analysis.\n  - [FrequencyMaster](#6-frequencymaster): Analyze the frequency of characters or words in strings.\n  - [InflectionMaster](#7-inflectionmaster): Handle pluralization and singularization of words.\n  - [InitialsMaster](#8-initialsmaster): Extract initials from names or phrases.\n  - [ManipulationMaster](#9-ManipulationMaster): Reverse, shuffle, or manipulate strings in various ways.\n  - [MaskingMaster](#10-maskingmaster): Mask sensitive parts of strings, like credit card numbers or emails.\n  - [ObfuscationMaster](#11-obfuscationmaster): Obfuscate and deobfuscate strings for privacy or security.\n  - [SanitizationMaster](#12-SanitizationMaster): Sanitize strings by removing unwanted characters or formatting.\n  - [SearchMaster](#13-searchmaster): Search within strings using fuzzy search, proximity search, and more.\n  - [SimilarityMaster](#14-similaritymaster): Calculate similarity between strings using various algorithms.\n  - [SlugMaster](#15-slugmaster): Convert strings to URL-friendly slugs.\n  - [TemplateMaster](#16-templatemaster): Perform string interpolation and templating.\n  - [TrimmingMaster](#17-TrimmingMaster): Trim whitespace or specific characters from strings.\n  - [ValidationMaster](#18-validationmaster): Validate strings against various rules, like email or URL formats.\n- [Contributing](#3-contributing)\n- [License](#4-license)\n- [Contact](#5-contact)\n\n## 1. Installation\n\nTo install the `string-master` package, use npm or yarn:\n\n```bash\nnpm install string-master\n# or\nyarn add string-master\n```\n## 2. Usage\n### 1. CasingMaster\nThe CasingMaster class provides methods to convert strings to various cases, such as Camel Case, Snake Case, Pascal Case, and more.\n```ts\nimport { CasingMaster } from 'string-master';\n\nconsole.log(CasingMaster.toCamelCase('hello world')); // 'helloWorld'\nconsole.log(CasingMaster.toSnakeCase('hello world')); // 'hello_world'\nconsole.log(CasingMaster.toPascalCase('hello world')); // 'HelloWorld'\nconsole.log(CasingMaster.toKebabCase('hello world')); // 'hello-world'\nconsole.log(CasingMaster.toScreamingSnakeCase('hello world')); // 'HELLO_WORLD'\nconsole.log(CasingMaster.toSentenceCase('HELLO WORLD')); // 'Hello world'\nconsole.log(CasingMaster.toTitleCase('hello world')); // 'Hello World'\nconsole.log(CasingMaster.smartCaseConvert('hello world', 'pascal')); // 'HelloWorld'\nconsole.log(CasingMaster.smartCaseConvert('hello world', 'kebab')); // 'hello-world'\nconsole.log(CasingMaster.smartCaseConvert('HELLO WORLD', 'sentence')); // 'Hello world'\n```\n\n### 2. ConversionMaster\nThe ConversionMaster class provides methods to convert strings to different types, such as from a string to hexadecimal, integer, or binary.\n```ts\nimport { ConversionMaster } from 'string-master';\n\nconsole.log(ConversionMaster.toBoolean('yes')); // true\nconsole.log(ConversionMaster.toBoolean('on')); // true\nconsole.log(ConversionMaster.toBoolean('0')); // false\nconsole.log(ConversionMaster.toBoolean('true')); // true\n\nconsole.log(ConversionMaster.toFloat('123.456', 2)); // 123.46\nconsole.log(ConversionMaster.toFloat('123.456')); // 123.456\n\nconsole.log(ConversionMaster.toInt('42')); // 42\nconsole.log(ConversionMaster.toInt('0x1A')); // 26 (hexadecimal)\n\nconsole.log(ConversionMaster.toJson('{\"name\": \"John\"}')); // { name: 'John' }\nconsole.log(ConversionMaster.fromJson({ name: 'John' })); // '{\"name\":\"John\"}'\n\nconsole.log(ConversionMaster.toBase64('Hello World!')); // 'SGVsbG8gV29ybGQh'\nconsole.log(ConversionMaster.fromBase64('SGVsbG8gV29ybGQh')); // 'Hello World!'\n\nconsole.log(ConversionMaster.toHex('Hello')); // '48656c6c6f'\nconsole.log(ConversionMaster.fromHex('48656c6c6f')); // 'Hello'\n```\n\n### 3. EmojiMaster\nThe EmojiMaster class helps find, replace, or manipulate emojis in strings.\n```ts\nimport { EmojiMaster } from 'string-master';\n\nconsole.log(EmojiMaster.findEmojis('Hello 👋 World 🌍!')); // ['👋', '🌍']\nconsole.log(EmojiMaster.countEmojis('Hello 👋 World 🌍!')); // 2\nconsole.log(EmojiMaster.containsEmojis('Hello 👋 World!')); // true\nconsole.log(EmojiMaster.extractEmojiSequences('Hello 👋 World 🌍! 🎉')); // ['👋', '🌍', '🎉']\nconsole.log(EmojiMaster.replaceEmojis('Hello 👋 World 🌍!', '[emoji]')); // 'Hello [emoji] World [emoji]!'\nconst replacements = { happy: '😊', sad: '😢' };\nconst modifiedTextWithEmojis = EmojiMaster.replaceWordsWithEmojis('I am very happy and a bit sad.', replacements);\nconsole.log(modifiedTextWithEmojis); // 'I am very 😊 and a bit 😢.'\n```\n\n### 4. EntropyMaster\nThe EntropyMaster class calculates the entropy of a string, useful for cryptography or information theory.\n```ts\nimport { EntropyMaster } from 'string-master';\n\nconsole.log(EntropyMaster.calculateEntropy('password123')); // 3.27\nconsole.log(EntropyMaster.getStrength('password123')); // 'Moderate'\n```\n\n### 5. FrequencyMaster\nThe FrequencyMaster class analyzes the frequency of characters or words in a string.\n```ts\nimport { FrequencyMaster } from 'string-master';\n\nconst text = 'hello world hello';\n\nconsole.log(FrequencyMaster.countWordFrequency(text)); // { hello: 2, world: 1 }\nconsole.log(FrequencyMaster.countCharacterFrequency(text)); // { h: 1, e: 1, l: 2, o: 2, w: 1, r: 1, d: 1 }\nconsole.log(FrequencyMaster.findMostFrequentWords(text, 1)); // [{ word: \"hello\", count: 2 }]\nconsole.log(FrequencyMaster.findLeastFrequentWords(text, 1)); // [{ word: \"world\", count: 1 }]\nconsole.log(FrequencyMaster.getTopNCharacters(text, 2)); // [{ character: \"l\", count: 5 }, { character: \"o\", count: 3 }]\n```\n### 6. InflectionMaster\nThe InflectionMaster class handles pluralization and singularization of words.\n\nExamples:\n```ts\nimport { InflectionMaster } from 'string-master';\n\n// Pluralize\nconst pluralPerson = InflectionMaster.pluralize('person');\nconsole.log(pluralPerson); // 'people'\n\nconst pluralOctopus = InflectionMaster.pluralize('octopus');\nconsole.log(pluralOctopus); // 'octopuses'\n\nconst pluralHat = InflectionMaster.pluralize('Hat');\nconsole.log(pluralHat); // 'Hats'\n\n// Singularize\nconst singularPeople = InflectionMaster.singularize('people');\nconsole.log(singularPeople); // 'person'\n\nconst singularOctopuses = InflectionMaster.singularize('octopuses');\nconsole.log(singularOctopuses); // 'octopus'\n\nconst singularHats = InflectionMaster.singularize('Hats');\nconsole.log(singularHats); // 'Hat'\n\n// Inflect based on count\nconst inflectPerson1 = InflectionMaster.inflect('people', 1);\nconsole.log(inflectPerson1); // 'person'\n\nconst inflectOctopuses1 = InflectionMaster.inflect('octopuses', 1);\nconsole.log(inflectOctopuses1); // 'octopus'\n\nconst inflectHats1 = InflectionMaster.inflect('Hats', 1);\nconsole.log(inflectHats1); // 'Hat'\n\nconst inflectGuys1 = InflectionMaster.inflect('guys', 1);\nconsole.log(inflectGuys1); // 'guy'\n\nconst inflectInches15 = InflectionMaster.inflect('inches', 1.5);\nconsole.log(inflectInches15); // 'inches'\n\nconst inflectPerson2 = InflectionMaster.inflect('person', 2);\nconsole.log(inflectPerson2); // 'people'\n\nconst inflectOctopus2 = InflectionMaster.inflect('octopus', 2);\nconsole.log(inflectOctopus2); // 'octopuses'\n\nconst inflectHat2 = InflectionMaster.inflect('Hat', 2);\nconsole.log(inflectHat2); // 'Hats'\n```\n\n### 7. InitialsMaster\nThe InitialsMaster class extracts initials from a string.\n\nExamples:\n```ts\nimport { InitialsMaster } from 'string-master';\n\n// Extract initials for a single name\nconst initials1 = InitialsMaster.extractInitials('John Doe');\nconsole.log(initials1); // 'JD'\n\n// Extract initials for multiple names\nconst initials2 = InitialsMaster.extractInitials(['John Doe', 'Jane Smith']);\nconsole.log(initials2); // ['JD', 'JS']\n\n// Extract initials with a length of 3\nconst initials3 = InitialsMaster.extractInitials('John Doe', { length: 3 });\nconsole.log(initials3); // 'JDo'\n\n// Add initials to a single name\nconst nameWithInitials1 = InitialsMaster.addInitialsTo('John Doe');\nconsole.log(nameWithInitials1); // 'John Doe (JD)'\n\n// Add initials to multiple names\nconst namesWithInitials2 = InitialsMaster.addInitialsTo(['John Doe', 'Jane Smith']);\nconsole.log(namesWithInitials2);\n// ['John Doe (JD)', 'Jane Smith (JS)']\n\n// Add initials with custom length\nconst nameWithInitials3 = InitialsMaster.addInitialsTo('John Doe', { length: 3 });\nconsole.log(nameWithInitials3); // 'John Doe (JDo)'\n\n// Add initials with predefined initials for names\nconst nameWithInitials4 = InitialsMaster.addInitialsTo('John Doe', { existing: { 'John Doe': 'JDoe' } });\nconsole.log(nameWithInitials4); // 'John Doe (JDoe)'\n\n// Parse name without email\nconst parsedName1 = InitialsMaster.parse('John Doe');\nconsole.log(parsedName1); // { name: 'John Doe', initials: 'JD' }\n\n// Parse a single name\nconst parsedName2 = InitialsMaster.parse('John Doe \u003cjohn.doe@example.com\u003e');\nconsole.log(parsedName2);\n// { name: 'John Doe', initials: 'JD', email: 'john.doe@example.com' }\n\n// Parse multiple names\nconst parsedNames3 = InitialsMaster.parse(['John Doe \u003cjohn.doe@example.com\u003e', 'Jane Smith']);\nconsole.log(parsedNames3);\n// [\n//   { name: 'John Doe', initials: 'JD', email: 'john.doe@example.com' },\n//   { name: 'Jane Smith', initials: 'JS' }\n// ]\n\n// Create initials from a phrase, excluding certain words\nconst initialsPhrase = InitialsMaster.createInitialsFromPhrase('The Quick Brown Fox', ['the', 'of']);\nconsole.log(initialsPhrase); // 'QBF'\n\n// Abbreviate a full name\nconst abbreviatedName = InitialsMaster.abbreviateName('John Michael Smith');\nconsole.log(abbreviatedName); // 'J.M.S.'\n\n// Generate an acronym from a phrase\nconst acronymASAP = InitialsMaster.generateAcronym('As Soon As Possible');\nconsole.log(acronymASAP); // 'ASAP'\n\n// Get the first letter of each word in a text\nconst firstLetters = InitialsMaster.getFirstLetterOfEachWord('Hello World Example');\nconsole.log(firstLetters); // 'HWE'\n\n// Generate a custom acronym from a phrase, excluding certain words\nconst customAcronym = InitialsMaster.generateCustomAcronym('For Your Information', ['for', 'your']);\nconsole.log(customAcronym); // 'I'\n\n```\n\n### 8. ManipulationMaster\nThe ManipulationMaster class provides methods to perform various manipulations on strings, like reversing or shuffling.\n\nExamples:\n\n```ts\nimport { ManipulationMaster } from 'string-master';\n\n// Extract the string between two substrings\nconst betweenResult = ManipulationMaster.between('Hello [World]!', '[', ']');\nconsole.log(betweenResult); // 'World'\n\n// Remove a specific prefix from the start of the string\nconst chompLeftResult = ManipulationMaster.chompLeft('HelloWorld', 'Hello');\nconsole.log(chompLeftResult); // 'World'\n\n// Remove a specific suffix from the end of the string\nconst chompRightResult = ManipulationMaster.chompRight('HelloWorld', 'World');\nconsole.log(chompRightResult); // 'Hello'\n\n// Remove all characters except for letters and numbers\nconst removeNonAlphaNumericResult = ManipulationMaster.removeNonAlphaNumeric('Hello, World! 123');\nconsole.log(removeNonAlphaNumericResult); // 'HelloWorld123'\n\n// Truncate the string to a specified length and add an ellipsis if necessary\nconst truncateResult = ManipulationMaster.truncate('This is a long string', 10);\nconsole.log(truncateResult); // 'This is a...'\n\n// Replace all occurrences of a target string with another string\nconst replaceAllResult = ManipulationMaster.replaceAll('foo bar foo', 'foo', 'baz');\nconsole.log(replaceAllResult); // 'baz bar baz'\n\n// Reverse the string\nconst reverseResult = ManipulationMaster.reverse('abc');\nconsole.log(reverseResult); // 'cba'\n\n// Extract the first N characters, or the last N characters if N is negative\nconst getLeftResult = ManipulationMaster.getLeft('HelloWorld', 5);\nconsole.log(getLeftResult); // 'Hello'\nconst getRightResult = ManipulationMaster.getRight('HelloWorld', -5);\nconsole.log(getRightResult); // 'World'\n\n// Remove all occurrences of specified characters\nconst removeAllResult = ManipulationMaster.removeAll('Hello World', ' ', 'l');\nconsole.log(removeAllResult); // 'HeoWord'\n\n// Convert a string into an array of lines, normalizing newlines\nconst linesResult = ManipulationMaster.lines('Hello\\r\\nWorld\\r\\n!');\nconsole.log(linesResult); // ['Hello', 'World', '!']\n\n// Remove punctuation from the string\nconst stripPunctuationResult = ManipulationMaster.stripPunctuation('Hello, world!');\nconsole.log(stripPunctuationResult); // 'Hello world'\n\n// Ensure that the string starts with the specified prefix\nconst ensureLeftResult = ManipulationMaster.ensureLeft('world', 'hello ');\nconsole.log(ensureLeftResult); // 'hello world'\n\n// Ensure that the string ends with the specified suffix\nconst ensureRightResult = ManipulationMaster.ensureRight('hello', ' world');\nconsole.log(ensureRightResult); // 'hello world'\n\n// Convert non-Latin characters to their Latin equivalents\nconst latiniseResult = ManipulationMaster.latinise('Olá, mundo!');\nconsole.log(latiniseResult); // 'Ola, mundo!'\n\n// Add ordinal suffixes to numbers in a string\nconst ordinalizeResult = ManipulationMaster.ordinalize('the 1 pitch and 22 jumps');\nconsole.log(ordinalizeResult); // 'the 1st pitch and 22nd jumps'\n```\n\n### 9. MaskingMaster\nThe MaskingMaster class masks parts of a string, such as credit card numbers or emails.\n\nExamples:\n```ts\nimport { MaskingMaster } from 'string-master';\n\n// Mask all but the last 4 digits of a credit card number\nconst maskedCreditCard = MaskingMaster.maskCreditCard('1234567812345678');\nconsole.log(maskedCreditCard); // '************5678'\n\n// Mask an email address, revealing only the first letter of the username and the domain\nconst maskedEmail = MaskingMaster.maskEmail('john.doe@example.com');\nconsole.log(maskedEmail); // 'j*******@example.com'\n\n// Mask a Social Security Number (SSN), revealing only the last 4 digits\nconst maskedSSN = MaskingMaster.maskSSN('123-45-6789');\nconsole.log(maskedSSN); // '***-**-6789'\n\n// Mask a generic string by replacing characters with a specified masking character\nconst maskedString = MaskingMaster.maskString('SensitiveData', 2, 2);\nconsole.log(maskedString); // 'Se********ta'\n```\n### 10. ObfuscationMaster\nThe ObfuscationMaster class obfuscates and deobfuscates strings for privacy or security purposes.\n\nExamples:\n\n```ts\nimport { ObfuscationMaster } from 'string-master';\n\n// Example of obfuscating text with a shift of 3\nconst obfuscated = ObfuscationMaster.obfuscate('Hello World', 3);\nconsole.log(obfuscated); // \"Khoor#Zruog\"\n\n// Example of deobfuscating the text with the same shift of 3\nconst deobfuscated = ObfuscationMaster.deobfuscate('Khoor#Zruog', 3);\nconsole.log(deobfuscated); // \"Hello World\"\n\n// Example of XOR-based obfuscation with a single-character key\nconst obfuscatedXOR = ObfuscationMaster.obfuscateXOR('Hello World', 'K');\nconsole.log(obfuscatedXOR); // .''$k$9'/\n\n// Example of deobfuscating XOR-obfuscated text with the same key\nconst original = ObfuscationMaster.deobfuscateXOR(obfuscatedXOR, 'K');\nconsole.log(original); // \"Hello World\"\n```\n### 11. SanitizationMaster\nThe SanitizationMaster class provides methods to sanitize strings, removing unwanted characters or formatting.\n\nExamples:\n\n```ts\nimport { SanitizationMaster } from 'string-master';\n\n// Example of escaping HTML characters\nconst escapedHtml = SanitizationMaster.escapeHtml('\u003cdiv\u003eHello \u0026 welcome!\u003c/div\u003e');\nconsole.log(escapedHtml); // \"\u0026lt;div\u0026gt;Hello \u0026amp; welcome!\u0026lt;/div\u0026gt;\"\n\n// Example of removing control characters\nconst cleanedString = SanitizationMaster.removeControlCharacters('Hello\\u0001World\\u0002');\nconsole.log(cleanedString); // \"HelloWorld\"\n\n// Example of sanitizing a string for safe display (escaping HTML + removing control characters)\nconst sanitizedString = SanitizationMaster.sanitizeForDisplay('\u003cdiv\u003eHello\\u0001World\u003c/div\u003e');\nconsole.log(sanitizedString); // \"\u0026lt;div\u0026gt;HelloWorld\u0026lt;/div\u0026gt;\"\n```\n\n### 12. SearchMaster\nThe SearchMaster class provides methods for searching within strings, including fuzzy search and proximity search.\n\nExamples:\n\n```ts\nimport { SearchMaster } from 'string-master';\n\n// Example: Finding the first occurrence of a substring\nconst firstIndex = SearchMaster.indexOf('Hello, world!', 'world');\nconsole.log(firstIndex); // 7\n\n// Example: Finding the last occurrence of a substring\nconst lastIndex = SearchMaster.lastIndexOf('Hello, world! world!', 'world');\nconsole.log(lastIndex); // 14\n\n// Example: Finding the nth occurrence of a substring\nconst nthIndex = SearchMaster.nthIndexOf('abcabcabc', 'abc', 2);\nconsole.log(nthIndex); // 3\n\n// Example: Matching all occurrences of a pattern\nconst matches = SearchMaster.matchAll('Hello 123, world 456!', /\\d+/g);\nconsole.log(matches); // ['123', '456']\n\n// Example: Finding the first match with a regular expression\nconst firstMatch = SearchMaster.findFirst('Hello 123 world', /\\d+/);\nconsole.log(firstMatch); // '123'\n\n// Example: Performing a fuzzy search\nconst fuzzyResults = SearchMaster.fuzzySearch('Hello, wrld!', 'world', 1);\nconsole.log(fuzzyResults); // ['wrld']\n\n// Example: Proximity search\nconst proximity = SearchMaster.proximitySearch('The quick brown fox jumps over the lazy dog', 'fox', 'dog', 5);\nconsole.log(proximity); // true\n\n// Example: Highlighting a substring\nconst highlighted = SearchMaster.highlight('Hello, world!', 'world');\nconsole.log(highlighted); // 'Hello, \u003cmark\u003eworld\u003c/mark\u003e!'\n\n```\n### 13. SimilarityMaster\nThe SimilarityMaster class calculates the similarity between two strings using various algorithms like Jaccard, Levenshtein, and Jaro-Winkler.\n\nExamples:\n\n```ts\nimport { SimilarityMaster } from 'string-master';\n\n\n// Example of checking similarity with a threshold of 0.8\nconst sm = new SimilarityMaster(['apple', 'banana', 'grape']);\nconst hasSimilar = sm.hasSimilarString('apples', 0.8);\nconsole.log(hasSimilar); // true\n\n// Example of getting similarity scores using the Dice coefficient\nconst scores = sm.getSimilarStrings('apple', 'dice');\nconsole.log(scores);\n// [\n//   { element: 'apple', similarity: 1.0 },\n//   { element: 'banana', similarity: 0 },\n//   { element: 'grape', similarity: 0.25 }\n// ]\n\n// Example of calculating dice similarity between two strings\nconst dicsScore = SimilarityMaster.calculateSimilarity('hello', 'hallo', 'dice');\nconsole.log(dicsScore); // 0.5\n\n// Example of calculating Levenshtein similarity between two strings\nconst levenshteinScore = SimilarityMaster.calculateSimilarity('hello', 'hallo', 'levenshtein');\nconsole.log(levenshteinScore); // 0.8\n\n// Example of calculating jaro-winkler similarity between two strings\nconst jaroWinklerScore = SimilarityMaster.calculateSimilarity('hello', 'hallo', 'jaro-winkler');\nconsole.log(jaroWinklerScore); // 0.88\n\n// Example of calculating jaccard similarity between two strings\nconst jaccardScore = SimilarityMaster.calculateSimilarity('hello', 'hallo', 'jaccard');\nconsole.log(jaccardScore); // 0.33\n\n// Example of comparing multiple strings using the Jaccard index\nconst comparison = SimilarityMaster.compareMultipleStrings('apple', ['apples', 'banana', 'grape'], 'jaccard');\nconsole.log(comparison.bestMatch); // { target: 'apples', rating: 0.8 }\nconsole.log(comparison.bestMatchIndex); // 0\n```\n\n### 14. SlugMaster\nThe SlugMaster class converts strings to URL-friendly slugs.\n\nExamples:\n\n```ts\nimport { SlugMaster } from 'string-master';\n\n// Example of converting a string to a URL-friendly slug\nconst slug1 = SlugMaster.slugify('Hello World!');\nconsole.log(slug1); // \"hello-world\"\n\nconst slug2 = SlugMaster.slugify('JavaScript Mastery');\nconsole.log(slug2); // \"javascript-mastery\"\n\n// Example of converting a string to a slug with custom separator and case sensitivity\nconst slugWithOptions1 = SlugMaster.slugifyWithOptions('Hello World!', { separator: '_', lowercase: false });\nconsole.log(slugWithOptions1); // \"Hello_World\"\n\n// Example of setting custom rules for slugification\nSlugMaster.setCustomRules([{ rule: /and/g, replacement: 'n' }]);\nconst slugWithRules = SlugMaster.slugify('Rock and Roll');\nconsole.log(slugWithRules); // \"rock-n-roll\"\n```\n\n### 15. TemplateMaster\nThe TemplateMaster class allows for simple templating and string interpolation.\n\nExamples:\n\n```ts\nimport { TemplateMaster } from 'string-master';\n\n// Example of filling a template string with provided values\nconst result1 = TemplateMaster.fill('Hello, {name}!', { name: 'John' });\nconsole.log(result1); // \"Hello, John!\"\n\n// Example of filling a template string with custom delimiters\nconst result2 = TemplateMaster.fillWithDelimiter('Hello, [name]!', { name: 'John' }, ['[', ']']);\nconsole.log(result2); // \"Hello, John!\"\n\n// Example of escaping special characters in a template string\nconst result3 = TemplateMaster.escape('Hello, {name}! \u003cscript\u003ealert(\"XSS\")\u003c/script\u003e');\nconsole.log(result3); // \"Hello, {name}! \u0026lt;script\u0026gt;alert(\u0026quot;XSS\u0026quot;)\u0026lt;/script\u0026gt;\"\n\n// Example of converting a template string to a function\nconst templateFunc = TemplateMaster.toFunction('Hello, {name}!');\nconst result4 = templateFunc({ name: 'John' });\nconsole.log(result4); // \"Hello, John!\"\n```\n\n### 16. TrimmingMaster\nThe TrimmingMaster class provides various methods for trimming whitespace or characters from strings.\n\nExamples:\n\n```ts\nimport { TrimmingMaster } from 'string-master';\n\n// Example of trimming specified characters from the start of the string\nconst result1 = TrimmingMaster.trimStart('   Hello', ' ');\nconsole.log(result1); // 'Hello'\n\n// Example of trimming specified characters from the end of the string\nconst result2 = TrimmingMaster.trimEnd('Hello   ', ' ');\nconsole.log(result2); // 'Hello'\n\n// Example of collapsing multiple spaces into a single space\nconst result3 = TrimmingMaster.collapseWhitespace('Hello   World! ');\nconsole.log(result3); // 'Hello World!'\n```\n\n### 17. ValidationMaster\nThe ValidationMaster class validates strings against different rules, such as email or URL formats.\n\nExamples:\n```ts\nimport { ValidationMaster } from 'string-master';\n\n// Example of checking if a string contains only alphabetic characters\nconsole.log(ValidationMaster.isAlpha('abc')); // true\nconsole.log(ValidationMaster.isAlpha('abc123')); // false\n\n// Example of checking if a string contains only alphanumeric characters\nconsole.log(ValidationMaster.isAlphaNumeric('abc123')); // true\nconsole.log(ValidationMaster.isAlphaNumeric('abc!123')); // false\n\n// Example of checking if a string is empty or contains only whitespace\nconsole.log(ValidationMaster.isEmpty('')); // true\nconsole.log(ValidationMaster.isEmpty('   ')); // true\nconsole.log(ValidationMaster.isEmpty('abc')); // false\n\n// Example of checking if a string is in lowercase\nconsole.log(ValidationMaster.isLower('abc')); // true\nconsole.log(ValidationMaster.isLower('Abc')); // false\n\n// Example of checking if a string contains only numeric characters\nconsole.log(ValidationMaster.isNumeric('123')); // true\nconsole.log(ValidationMaster.isNumeric('123a')); // false\n\n// Example of checking if a string is in uppercase\nconsole.log(ValidationMaster.isUpper('ABC')); // true\nconsole.log(ValidationMaster.isUpper('Abc')); // false\n\n// Example of checking if a string starts with a given substring\nconsole.log(ValidationMaster.startsWith('Hello, world!', 'Hello')); // true\n\n// Example of checking if a string ends with any of the specified suffixes\nconsole.log(ValidationMaster.endsWith('hello', 'lo', 'world')); // true\nconsole.log(ValidationMaster.endsWith('hello', 'hi')); // false\n\n// Example of comparing two strings, ignoring case\nconsole.log(ValidationMaster.equalsIgnoreCase('Hello', 'hello')); // true\n\n// Example of checking if a string contains the specified substring\nconsole.log(ValidationMaster.contains('hello world', 'world')); // true\n\n// Example of checking if two strings are anagrams of each other\nconsole.log(ValidationMaster.isAnagram('listen', 'silent')); // true\n\n// Example of checking if a string is a palindrome\nconsole.log(ValidationMaster.isPalindrome('A man, a plan, a canal, Panama')); // true\n```\n\n## 3. Contributing\nI welcome contributions from the community to help improve the library. Please follow the [guidelines](CONTRIBUTING.md) below to get started.\n## 4. License\n\nString Master is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.\n\n## 5. Contact\n\nIf you have any questions, suggestions, or would like to collaborate, please feel free to reach out:\n\n- **Email:** [ahmadbilal.3491@gmail.com](mailto:ahmadbilal.3491@gmail.com)\n- **LinkedIn:** [Ahmad Bilal](https://www.linkedin.com/in/ahmad-bilal-920637165)\n\nI look forward to hearing from you!\n\n[build-img]:https://github.com/dev-ahmadbilal/string-master/actions/workflows/release.yml/badge.svg\n[build-url]:https://github.com/dev-ahmadbilal/string-master/actions/workflows/release.yml\n[npm-img]:https://img.shields.io/npm/v/string-master\n[npm-url]:https://www.npmjs.com/package/string-master\n[download-img]: https://badgen.net/npm/dt/string-master\n[issues-img]:https://img.shields.io/github/issues/dev-ahmadbilal/string-master\n[issues-url]:https://github.com/dev-ahmadbilal/string-master/issues\n[codecov-img]:https://codecov.io/gh/dev-ahmadbilal/string-master/branch/main/graph/badge.svg\n[codecov-url]:https://codecov.io/gh/dev-ahmadbilal/string-master\n[semantic-release-img]:https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\n[semantic-release-url]:https://github.com/semantic-release/semantic-release\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdev-ahmadbilal%2Fstring-master","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdev-ahmadbilal%2Fstring-master","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdev-ahmadbilal%2Fstring-master/lists"}