{"id":49290964,"url":"https://github.com/azizbecha/strkit","last_synced_at":"2026-04-26T00:04:24.638Z","repository":{"id":272073592,"uuid":"915445334","full_name":"azizbecha/strkit","owner":"azizbecha","description":"strkit is a utility library offering a collection of essential string functions including validation, case conversion, truncation, and more. Ideal for both JavaScript and TypeScript developers to simplify string operations in their applications.","archived":false,"fork":false,"pushed_at":"2025-03-16T01:19:52.000Z","size":78,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-20T17:48:39.471Z","etag":null,"topics":["string-formatter","string-manipulation","string-methods","strings"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@azizbecha/strkit","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/azizbecha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-01-11T21:30:01.000Z","updated_at":"2025-07-31T06:54:19.000Z","dependencies_parsed_at":"2025-01-11T22:30:09.812Z","dependency_job_id":"6254dc3d-0773-4c8d-bb87-7e469a9dadd6","html_url":"https://github.com/azizbecha/strkit","commit_stats":null,"previous_names":["azizbecha/strkit"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/azizbecha/strkit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azizbecha%2Fstrkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azizbecha%2Fstrkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azizbecha%2Fstrkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azizbecha%2Fstrkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azizbecha","download_url":"https://codeload.github.com/azizbecha/strkit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azizbecha%2Fstrkit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32280982,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T18:29:39.964Z","status":"ssl_error","status_checked_at":"2026-04-25T18:29:32.149Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["string-formatter","string-manipulation","string-methods","strings"],"created_at":"2026-04-26T00:04:24.031Z","updated_at":"2026-04-26T00:04:24.617Z","avatar_url":"https://github.com/azizbecha.png","language":"TypeScript","readme":"\u003ch1 align=\"center\"\u003estrkit\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/v/@azizbecha/strkit\" alt=\"npm version\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/dt/@azizbecha/strkit\" alt=\"npm downloads\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/license-MIT-blue\" alt=\"License\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/last-commit/azizbecha/strkit\" alt=\"GitHub last commit\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/stars/azizbecha/strkit\" alt=\"GitHub stars\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/issues/azizbecha/strkit\" alt=\"GitHub issues\"\u003e\n\u003c/p\u003e\n\n`strkit` is a utility library that provides a collection of commonly used string functions in JavaScript/TypeScript. Whether you need to validate emails, convert case styles, trim spaces, or manipulate strings in other ways, `strkit` has got you covered. The goal of this library is to make string handling easier and more efficient across all your projects.\n\n---\n\n## Features\n\n- **String Validation**: Functions like `isEmail` and `isURL` to validate strings.\n- **String Manipulation**: Functions for trimming, reversing, truncating, and more.\n- **Case Conversion**: Convert strings between different case styles.\n- **Easy to Use**: Just import the required function and get started.\n\n---\n\n## Installation\n\nYou can install `strkit` as an NPM package:\n\n```bash\nnpm install @azizbecha/strkit\n```\n\n---\n\n## Usage\n\n### CommonJS\n\n```javascript\nconst { isEmail, truncate } = require(\"@azizbecha/strkit\");\n\nconsole.log(isEmail(\"test@example.com\")); // true\nconsole.log(truncate(\"This is a very long string\", 10)); // 'This is a...'\n```\n\n### ES6\n\n```javascript\nimport strkit, { isEmail } from \"@azizbecha/strkit\";\n\nconsole.log(isEmail(\"test@example.com\")); // true\nconsole.log(strkit.truncate(\"This is a very long string\", 10)); // 'This is a...'\n```\n\n---\n\n## Functions\n\n| **Function**                 | **Description**                                                                        | **Example Usage**                                                                                                                                            | **Type Signature**                                                       |\n| ---------------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------ |\n| **capitalize**               | Capitalizes the first letter of a string.                                              | `capitalize('hello') // 'Hello'`                                                                                                                             | `(str: string) =\u003e string`                                                |\n| **compareVersion**           | Compares two versions \u003cbr /\u003e Returns `0` if equal, `1` if v1 \u003e v2, or `-1` if v2 \u003e v1. | `compareVersion('1.2.0', '1.3.0') // -1`                                                                                                                     | `(v1: string, v2: string) =\u003e number`                                     |\n| **countWordsMatching**       | Counts the words in a string matching a specific pattern.                              | `countWordsMatching('hello world', /o/) // 2`                                                                                                                | `(str: string, pattern: RegExp) =\u003e number`                               |\n| **decodeURL**                | Decodes a URL-encoded string.                                                          | `decodeURL('hello%20world') // 'hello world'`                                                                                                                | `(str: string) =\u003e string`                                                |\n| **diffStrings**              | Compares two strings and returns an array of differences.                              | `diffStrings('hello world', 'hello there'); // [{ type: 'equal', value: 'hello ' }, { type: 'removed', value: 'world' }, { type: 'added', value: 'there' }]` | `(str1: string, str2: string) =\u003e [{type, value}}]`                       |\n| **encodeURL**                | Encodes a string into a URL-safe format.                                               | `encodeURL('hello world') // 'hello%20world'`                                                                                                                | `(str: string) =\u003e string`                                                |\n| **endsWith**                 | Checks if a string ends with a given suffix.                                           | `endsWith('hello', 'lo') // true`                                                                                                                            | `(str: string, suffix: string) =\u003e boolean`                               |\n| **extractHashtags**          | Extracts all hashtags from a string.                                                   | `extractHashtags('#hello #world') // ['#hello', '#world']`                                                                                                   | `(str: string) =\u003e string[]`                                              |\n| **extractMentions**          | Extracts all mentions (e.g., @username) from a string.                                 | `extractMentions('@user @test') // ['@user', '@test']`                                                                                                       | `(str: string) =\u003e string[]`                                              |\n| **formatNumber**             | Formats numbers into abbreviated form (e.g., 1.2k).                                    | `formatNumber(1200) // '1.2k'`                                                                                                                               | `(num: number, digits?: number) =\u003e string`                               |\n| **generateId**               | Generates a random alphanumeric ID.                                                    | `generateId() // 'abc123xyz'`                                                                                                                                | `(length = 15: number) =\u003e string`                                        |\n| **invertCase**               | Inverts the case of each character in a string.                                        | `invertCase('Hello') // 'hELLO'`                                                                                                                             | `(str: string) =\u003e string`                                                |\n| **isAnagram**                | Checks if two strings are anagrams.                                                    | `isAnagram('listen', 'silent') // true`                                                                                                                      | `(str1: string, str2: string) =\u003e boolean`                                |\n| **isBoolean**                | Checks if a value is a boolean-like (e.g., true, \"yes\", 1).                            | `isBoolean('yes') // true`                                                                                                                                   | `(value: number) =\u003e boolean`                                             |\n| **isBtcAddress**             | Checks if a string is a valid Bitcoin address.                                         | `isBtcAddress('1A1zP...DivfNa') // true`                                                                                                                     | `(str: string) =\u003e boolean`                                               |\n| **isCreditCard**             | Checks if a string is a valid credit card number.                                      | `isCreditCard('4111...1111') // true`                                                                                                                        | `(str: string) =\u003e boolean`                                               |\n| **isEmail**                  | Checks if a string is a valid email address.                                           | `isEmail('test@example.com') // true`                                                                                                                        | `(email: string) =\u003e boolean`                                             |\n| **isEmoji**                  | Checks if a string contains emojis.                                                    | `isEmoji('😊') // true`                                                                                                                                      | `(str: string) =\u003e boolean`                                               |\n| **isIPv4Address**            | Checks if a string is a valid IPv4 address.                                            | `isIPv4Address('192.168.0.1') // true`                                                                                                                       | `(str: string) =\u003e boolean`                                               |\n| **isIPv6Address**            | Checks if a string is a valid IPv6 address.                                            | `isIPv6Address('::1') // true`                                                                                                                               | `(str: string) =\u003e boolean`                                               |\n| **isJSON**                   | Checks if a string is valid JSON.                                                      | `isJSON('{\"key\": 42}') // true`                                                                                                                              | `(str: string) =\u003e boolean`                                               |\n| **isJWT**                    | Checks if a string is a valid JSON Web Token (JWT).                                    | `isJWT('eyJhbGci...') // true`                                                                                                                               | `(str: string) =\u003e boolean`                                               |\n| **isPalindrome**             | Checks if a string is a palindrome.                                                    | `isPalindrome('racecar') // true`                                                                                                                            | `(str: string) =\u003e boolean`                                               |\n| **isURL**                    | Checks if a string is a valid URL.                                                     | `isURL('https://example.com'); // true`                                                                                                                      | `(str: string) =\u003e boolean`                                               |\n| **maskEmail**                | Masks an email address for privacy by replacing part of the email with asterisks..     | `maskEmail('test@example.com'); // \"t***@example.com\"`                                                                                                       | `(str: string) =\u003e string`                                                |\n| **readingTime**              | Estimates reading time for a given string.                                             | `readingTime('Lorem ipsum...') // '1 min'`                                                                                                                   | `(str: string, wpm = 200: number) =\u003e string`                             |\n| **removeSpaces**             | Removes all spaces from a string.                                                      | `removeSpaces('hello world') // 'helloworld'`                                                                                                                | `(str: string) =\u003e string`                                                |\n| **reverse**                  | Reverses the characters in a given string.                                             | `reverse('hello') // 'olleh'`                                                                                                                                | `(str: string) =\u003e string`                                                |\n| **startsWith**               | Checks if a string starts with a given prefix.                                         | `startsWith('hello', 'he') // true`                                                                                                                          | `(str: string, prefix: string) =\u003e boolean`                               |\n| **truncate**                 | Truncates a string to a specific length, appending ellipses if needed.                 | `truncate('hello world', 5) // 'hello...'`                                                                                                                   | `(str: string, maxLength?: number) =\u003e string`                            |\n| **truncateMiddle**           | Truncates the middle of a string to fit within a length, adding ellipses.              | `truncateMiddle('abcdef', 4) // 'a...f'`                                                                                                                     | `(str: string, maxLength: number) =\u003e string`                             |\n| **toCamelCase**              | Converts a string to camel case.                                                       | `toCamelCase('hello_world') // 'helloWorld'`                                                                                                                 | `(str: string) =\u003e string`                                                |\n| **toOrdinal**                | Converts a number to its ordinal form.                                                 | `toOrdinal(1) // '1st'`                                                                                                                                      | `(num: number) =\u003e string`                                                |\n| **clamp**                    | Clamps a number between a minimum and maximum value.                                   | `clamp(15, 0, 10); // 10`                                                                                                                                    | `(value: number, min: number, max: number) =\u003e number`                    |\n| **getDistanceBetweenPoints** | Calculates the distance between two points in a 2D plane.                              | `getDistanceBetweenPoints({ lon: 0, lat: 0 }, { lon: 3, lat: 4 }) // 5`                                                                                      | `({ lon: number, lat: number }, { lon: number, lat: number }) =\u003e number` |\n| **toDegrees**                | Converts radians to degrees.                                                           | `toDegrees(Math.PI) // 180`                                                                                                                                  | `(radians: number) =\u003e number`                                            |\n| **toRadians**                | Converts degrees to radians.                                                           | `toRadians(180) // Math.PI`                                                                                                                                  | `(degrees: number) =\u003e number`                                            |\n| **roundTo**                  | Rounds a number to a specified number of decimal places.                               | `roundTo(1.2345, 2) // 1.23`                                                                                                                                 | `(num: number, decimalPlaces: number) =\u003e number`                         |\n| **randomBetween**            | Generates a random number between a minimum and maximum value.                         | `randomBetween(1, 10) // 7`                                                                                                                                  | `(min: number, max: number) =\u003e number`                                   |\n| **startsWith**               | Checks if a string starts with a given prefix.                                         | `startsWith('hello', 'he') // true`                                                                                                                          | `(str: string, prefix: string) =\u003e boolean`                               |\n| **endsWith**                 | Checks if a string ends with a given suffix.                                           | `endsWith('hello', 'lo') // true`                                                                                                                            | `(str: string, suffix: string) =\u003e boolean`                               |\n\n## Development\n\nIf you'd like to contribute or modify the library, you can clone the repository and run the following commands to build the project:\n\n### 1. Clone the repository\n\n```bash\ngit clone https://github.com/azizbecha/strkit\n```\n\n### 2. Install dependencies\n\n```bash\nnpm install\n```\n\n### 3. Build the project\n\n```bash\nnpm run build\n```\n\n---\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n\n## Contributing\n\nFeel free to fork the repository, create an issue, or submit a pull request to contribute improvements or new features.\n\n---\n\n## Acknowledgments\n\n- Thanks to all contributors who make this library possible!\n\nAziz Becha.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazizbecha%2Fstrkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazizbecha%2Fstrkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazizbecha%2Fstrkit/lists"}