{"id":21922852,"url":"https://github.com/blckclov3r/utility-validate","last_synced_at":"2026-04-15T16:02:47.739Z","repository":{"id":231990125,"uuid":"779818791","full_name":"blckclov3r/utility-validate","owner":"blckclov3r","description":"A collection of validators, sanitizers, and utilities.","archived":false,"fork":false,"pushed_at":"2024-04-08T17:53:47.000Z","size":111,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-28T22:51:31.846Z","etag":null,"topics":["checker","hooks","manipulate","npm","npm-package","regex","regexp","test","utilities","utility","utility-library","utility-validate","utilize","utils","validate","validator"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/utility-validate","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/blckclov3r.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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-03-30T21:34:46.000Z","updated_at":"2024-04-08T17:02:06.000Z","dependencies_parsed_at":"2025-01-27T10:42:46.923Z","dependency_job_id":"e1bf185a-677d-46fc-b869-80b5463ed91e","html_url":"https://github.com/blckclov3r/utility-validate","commit_stats":null,"previous_names":["blckclov3r/utility-validate"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blckclov3r%2Futility-validate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blckclov3r%2Futility-validate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blckclov3r%2Futility-validate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blckclov3r%2Futility-validate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blckclov3r","download_url":"https://codeload.github.com/blckclov3r/utility-validate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244945623,"owners_count":20536297,"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":["checker","hooks","manipulate","npm","npm-package","regex","regexp","test","utilities","utility","utility-library","utility-validate","utilize","utils","validate","validator"],"created_at":"2024-11-28T21:07:30.636Z","updated_at":"2026-04-15T16:02:47.687Z","avatar_url":"https://github.com/blckclov3r.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# utility-validate\n\nA collection of validators, sanitizers, and utilities.\n\n[![npm version](https://img.shields.io/npm/v/utility-validate?style=flat-square\u0026alt=utility-validate)](https://www.npmjs.com/package/utility-validate)\n[![Bundlephobia](https://img.shields.io/bundlephobia/min/utility-validate)](https://bundlephobia.com/result?p=utility-validate)\n[![Downloads](https://img.shields.io/npm/dt/utility-validate.svg?style=flat-square)](https://www.npmjs.com/package/utility-validate)\n[![MIT License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/blckclov3r)\n[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/utility-validate)\n\n## Contents\n\n* [Installation](#installation)\n* [Usage](#usage)\n* [Contribution](#contribution)\n* [License](#license)\n\n## Installation\n\nInstall via NPM:\n\n```bash\nnpm install utility-validate\n```\n\nOr via Yarn:\n\n```bash\nyarn add utility-validate\n```\n\n## Usage\n\nFirst, import the `utility-validate` function:\n\n```typescript\nimport utilityValidate from 'utility-validate';\n```\n\nYou can now utilize the library's methods:\n\n```typescript\nconst {isEmail, removeWhitespace, sanitizeAlphaNumericSpace} = utilityValidate();\nconst email = isEmail('blckclov3r@gmail.com')\nconsole.log(email) // true\n```\n\nIf you prefer not to install the package and want to include the entry point directly in your project, you can use the\nfollowing script tags:\n\n- [https://cdn.jsdelivr.net/npm/utility-validate@1.0.7/dist/index.mjs](https://cdn.jsdelivr.net/npm/utility-validate@1.0.7/dist/index.mjs)\n- [https://unpkg.com/utility-validate@1.0.7/dist/index.mjs](https://unpkg.com/utility-validate@1.0.7/dist/index.mjs)\n\n```html\n\n\u003cscript type=\"module\"\u003e\n    import {isEmail} from 'https://unpkg.com/utility-validate@1.0.7/dist/index.mjs';\n\n    const email = isEmail('blckclov3r@gmail.com')\n    console.log(email) // true\n\u003c/script\u003e\n```\n\n## Utility\n\n| Function Name                   | Description                                                                              |\n|---------------------------------|------------------------------------------------------------------------------------------|\n| generateRandomString            | Generates a random string.                                                               |\n| removeWhitespace                | Removes whitespace from a string.                                                        |\n| sanitizeAlphaNumericSpace       | Sanitizes a string, keeping alphanumeric characters and spaces.                          |\n| sanitizeAlphaNumericLower       | Sanitizes a string, keeping only lowercase alphanumeric characters.                      |\n| sanitizeAlphaNumericUpper       | Sanitizes a string, keeping only uppercase alphanumeric characters.                      |\n| sanitizeNumericValue            | Sanitizes a string, keeping only numeric characters.                                     |\n| sanitizeIntegerValue            | Sanitizes a string, keeping only integer values.                                         |\n| sanitizeAlphaLower              | Sanitizes a string, keeping only lowercase alphabetic characters.                        |\n| sanitizeAlphaUpper              | Sanitizes a string, keeping only uppercase alphabetic characters.                        |\n| escapeHTML                      | Escapes HTML special characters in a string.                                             |\n| removeNonPrintableASCII         | Removes non-printable ASCII characters from a string.                                    |\n| removeControlCharacters         | Removes control characters from a string.                                                |\n| trimWhitespace                  | Trims whitespace from the beginning and end of a string.                                 |\n| removeDuplicateChars            | Removes duplicate characters from a string.                                              |\n| removeExtraWhitespace           | Removes extra whitespace from a string.                                                  |\n| decodeHTMLEntities              | Decodes HTML entities in a string.                                                       |\n| countCharacter                  | Counts occurrences of a character in a string.                                           |\n| collapseSpaces                  | Collapses consecutive spaces in a string to a single space.                              |\n| removeNonNumeric                | Removes non-numeric characters from a string.                                            |\n| extractNumbers                  | Extracts numeric values from a string.                                                   |\n| reverseString                   | Reverses a string.                                                                       |\n| capitalizeStr                   | Capitalizes the first letter of each word in a string.                                   |\n| truncateStr                     | Truncates a string to a specified length.                                                |\n| slugify                         | Converts a string to a URL-friendly slug.                                                |\n| countWords                      | Counts the number of words in a string.                                                  |\n| replaceStr                      | Replaces occurrences of a substring in a string.                                         |\n| toKebabCase                     | Converts a string to kebab case.                                                         |\n| toSnakeCase                     | Converts a string to snake case.                                                         |\n| toCamelCase                     | Converts a string to camel case.                                                         |\n| startsWith                      | Checks if a string starts with a specified substring.                                    |\n| endsWith                        | Checks if a string ends with a specified substring.                                      |\n| contains                        | Checks if a string contains a specified substring.                                       |\n| splitString                     | Splits a string into an array of substrings.                                             |\n| encodeToBase64                  | Encodes a string to Base64.                                                              |\n| decodeFromBase64                | Decodes a Base64 string.                                                                 |\n| getCurrentLogDate               | Gets the current date formatted for logging.                                             |\n| getCurrentYYYYMMDD              | Gets the current date in YYYYMMDD format.                                                |\n| getCurrentYYYYMMDDStr           | Gets the current date as a string in YYYYMMDD format.                                    |\n| getCurrentYYYYMMDDHHmmssSSS     | Gets the current date and time in YYYYMMDDHHmmssSSS format.                              |\n| getUnixTimestamp                | Gets the current Unix timestamp.                                                         |\n| toSafeNumber                    | Converts a value to a safe number.                                                       |\n| randomIntInRange                | Generates a random integer within a specified range.                                     |\n| shuffleArray                    | Shuffles the elements of an array.                                                       |\n| sanitizeEmail                   | Sanitizes an email address.                                                              |\n| sanitizeUrl                     | Sanitizes a URL.                                                                         |\n| sanitizePhoneNumber             | Sanitizes a phone number.                                                                |\n| sanitizeAlphaNumericSpecial     | Sanitizes a string, keeping alphanumeric characters and special characters.              |\n| sanitizeAlphaNumericAccents     | Sanitizes a string, keeping alphanumeric characters and accents.                         |\n| sanitizeHtmlTags                | Sanitizes HTML tags from a string.                                                       |\n| sanitizeFileName                | Sanitizes a filename.                                                                    |\n| sanitizeJson                    | Sanitizes JSON data.                                                                     |\n| sanitizeBase64                  | Sanitizes a Base64 string.                                                               |\n| sanitizeHexadecimal             | Sanitizes a hexadecimal string.                                                          |\n| sanitizeIPv4                    | Sanitizes an IPv4 address.                                                               |\n| sanitizeIPv6                    | Sanitizes an IPv6 address.                                                               |\n| sanitizeSSN                     | Sanitizes a Social Security Number (SSN).                                                |\n| sanitizeWithAllowedCharacters   | Sanitizes a string, keeping only specified allowed characters.                           |\n| toPascalCase                    | Converts a string to Pascal case.                                                        |\n| toConstantCase                  | Converts a string to constant case.                                                      |\n| toTrainCase                     | Converts a string to train case.                                                         |\n| toMacroCase                     | Converts a string to macro case.                                                         |\n| stringifyJson                   | Converts JSON data to a string.                                                          |\n| mapValuesJson                   | Maps values of a JSON object.                                                            |\n| mapKeysJson                     | Maps keys of a JSON object.                                                              |\n| omitJson                        | Omits specified keys from a JSON object.                                                 |\n| removeFalsyValues               | Removes falsy values from an array.                                                      |\n| groupObjectsByKey               | Groups objects in an array by a specified key.                                           |\n| findMaxValue                    | Finds the maximum value in an array.                                                     |\n| findMinValue                    | Finds the minimum value in an array.                                                     |\n| calculateMedian                 | Calculates the median of an array of numbers.                                            |\n| calculateStandardDeviation      | Calculates the standard deviation of an array of numbers.                                |\n| deepClone                       | Creates a deep clone of an object.                                                       |\n| distinctValues                  | Finds distinct values in an array.                                                       |\n| calculateFactorial              | Calculates the factorial of a number.                                                    |\n| calculatePower                  | Calculates the power of a number.                                                        |\n| roundToDecimalPlaces            | Rounds a number to a specified number of decimal places.                                 |\n| generateRange                   | Generates a range of numbers.                                                            |\n| calculateSquareRoot             | Calculates the square root of a number.                                                  |\n| calculateAbsoluteValue          | Calculates the absolute value of a number.                                               |\n| calculateLCM                    | Calculates the least common multiple of two numbers.                                     |\n| toBinary                        | Converts a number to binary.                                                             |\n| fromBinary                      | Converts binary to a number.                                                             |\n| toMorseCode                     | Converts a string to Morse code.                                                         |\n| fromMorseCode                   | Converts Morse code to a string.                                                         |\n| trimStart                       | Trims whitespace from the beginning of a string.                                         |\n| trimEnd                         | Trims whitespace from the end of a string.                                               |\n| padStart                        | Pads the start of a string with specified characters.                                    |\n| padEnd                          | Pads the end of a string with specified characters.                                      |\n| substring                       | Extracts a substring from a string.                                                      |\n| indexOf                         | Returns the index of the first occurrence of a substring in a string.                    |\n| lastIndexOf                     | Returns the index of the last occurrence of a substring in a string.                     |\n| extractURLs                     | Extracts URLs from a string.                                                             |\n| extractEmails                   | Extracts email addresses from a string.                                                  |\n| extractHashtags                 | Extracts hashtags from a string.                                                         |\n| extractMentions                 | Extracts mentions from a string.                                                         |\n| removeHTMLTags                  | Removes HTML tags from a string.                                                         |\n| removeSpecificHTMLTags          | Removes specific HTML tags from a string.                                                |\n| replaceHTMLEntities             | Replaces HTML entities in a string.                                                      |\n| encloseStringWith               | Encloses a string with specified characters.                                             |\n| trimMultiLineString             | Trims whitespace from the beginning and end of each line in a multiline string.          |\n| padWithAlternatingChars         | Pads a string with alternating characters.                                               |\n| replaceIfSurroundedByWhitespace | Replaces a substring if it's surrounded by whitespace.                                   |\n| toFixedLengthWithRepeat         | Truncates or pads a string to a fixed length, repeating characters if necessary.         |\n| formatJson                      | Formats JSON data for readability.                                                       |\n| toFixedLengthWithEllipsis       | Truncates or pads a string to a fixed length, adding an ellipsis if necessary.           |\n| toFixedLengthWithFiller         | Truncates or pads a string to a fixed length, filling with a specified filler character. |\n| toTitleCaseExcept               | Converts a string to title case, excluding specified words.                              |\n| generateFibonacciSequence       | Generates a Fibonacci sequence up to a specified length.                                 |\n| factorial                       | Calculates the factorial of a number.                                                    |\n| calculateCircleArea             | Calculates the area of a circle.                                                         |\n| degreesToRadians                | Converts degrees to radians.                                                             |\n| radiansToDegrees                | Converts radians to degrees.                                                             |\n| secondsToHHMMSS                 | Converts seconds to HH:MM:SS format.                                                     |\n| bytesToHumanReadable            | Converts bytes to a human-readable format.                                               |\n| getCurrentTimestampInSeconds    | Gets the current timestamp in seconds.                                                   |\n| millisecondsToSeconds           | Converts milliseconds to seconds.                                                        |\n| secondsToMilliseconds           | Converts seconds to milliseconds.                                                        |\n| formatDate                      | Formats a date according to specified format.                                            |\n| getCurrentTime                  | Gets the current time in HH:MM:SS format.                                                |\n| introSort                       | Sorts an array using intro sort algorithm.                                               |\n| mergeSort                       | Sorts an array using merge sort algorithm.                                               |\n| quickSort                       | Sorts an array using quick sort algorithm.                                               |\n| timSort                         | Sorts an array using Timsort algorithm.                                                  |\n\n## Validate\n\n| Function Name        | Description                                                         |\n|----------------------|---------------------------------------------------------------------|\n| isPositive           | Checks if a number is positive.                                     |\n| isNegative           | Checks if a number is negative.                                     |\n| isZero               | Checks if a number is zero.                                         |\n| isEmptyJson          | Checks if a JSON object is empty.                                   |\n| isIPv4               | Checks if a string is an IPv4 address.                              |\n| isIPv6               | Checks if a string is an IPv6 address.                              |\n| isLeapYear           | Checks if a year is a leap year.                                    |\n| isPrime              | Checks if a number is a prime number.                               |\n| isEven               | Checks if a number is even.                                         |\n| isInRange            | Checks if a number is within a specified range.                     |\n| isOdd                | Checks if a number is odd.                                          |\n| isDecimal            | Checks if a number is a decimal.                                    |\n| isDivisible          | Checks if a number is divisible by another.                         |\n| isMACAddress         | Checks if a string is a MAC address.                                |\n| isInteger            | Checks if a number is an integer.                                   |\n| isFloat              | Checks if a number is a float.                                      |\n| isObject             | Checks if a value is an object.                                     |\n| isTruthy             | Checks if a value is truthy.                                        |\n| isFalsy              | Checks if a value is falsy.                                         |\n| isError              | Checks if a value is an error.                                      |\n| isRegExp             | Checks if a value is a regular expression.                          |\n| isPromise            | Checks if a value is a promise.                                     |\n| isNumber             | Checks if a value is a number.                                      |\n| isBoolean            | Checks if a value is a boolean.                                     |\n| isFunction           | Checks if a value is a function.                                    |\n| isSymbol             | Checks if a value is a symbol.                                      |\n| isUndefined          | Checks if a value is undefined.                                     |\n| isNull               | Checks if a value is null.                                          |\n| isBlob               | Checks if a value is a Blob object.                                 |\n| isFile               | Checks if a value is a File object.                                 |\n| isBigInt             | Checks if a value is a BigInt.                                      |\n| isCreditCard         | Checks if a string is a credit card number.                         |\n| isURL                | Checks if a string is a URL.                                        |\n| isDate               | Checks if a value is a Date object.                                 |\n| isEmpty              | Checks if a value is empty.                                         |\n| isEqualArray         | Checks if two arrays are equal.                                     |\n| isEqualObject        | Checks if two objects are equal.                                    |\n| isAscii              | Checks if a string contains only ASCII characters.                  |\n| isDivisibleBy        | Checks if a number is divisible by a specified value.               |\n| isHexadecimal        | Checks if a string is a hexadecimal number.                         |\n| isHexColor           | Checks if a string is a hexadecimal color code.                     |\n| isHSL                | Checks if a string is an HSL color code.                            |\n| isIMEI               | Checks if a string is an IMEI number.                               |\n| isISBN               | Checks if a string is an ISBN number.                               |\n| isJSON               | Checks if a string is a valid JSON.                                 |\n| isJWT                | Checks if a string is a JSON Web Token (JWT).                       |\n| isEmail              | Checks if a string is an email address.                             |\n| isPalindrome         | Checks if a string is a palindrome.                                 |\n| isSSN                | Checks if a string is a Social Security Number (SSN).               |\n| isVIN                | Checks if a string is a Vehicle Identification Number (VIN).        |\n| isLatitude           | Checks if a string is a latitude coordinate.                        |\n| isLongitude          | Checks if a string is a longitude coordinate.                       |\n| isWhitespace         | Checks if a string contains only whitespace characters.             |\n| isIPAddress          | Checks if a string is an IP address.                                |\n| isOnlyAlpha          | Checks if a string contains only alphabetic characters.             |\n| isOnlyNumeric        | Checks if a string contains only numeric characters.                |\n| isOnlyAlphanumeric   | Checks if a string contains only alphanumeric characters.           |\n| isSafeNumberString   | Checks if a string represents a safe number.                        |\n| isEmptyOrWhitespace  | Checks if a string is empty or contains only whitespace characters. |\n| isObjectEmpty        | Checks if an object is empty.                                       |\n| isMimeType           | Checks if a string is a valid MIME type.                            |\n| isSlug               | Checks if a string is a URL slug.                                   |\n| isStrongPassword     | Checks if a string is a strong password.                            |\n| isAlpha              | Checks if a string contains only alphabetic characters.             |\n| isAlphaNumeric       | Checks if a string contains only alphanumeric characters.           |\n| hasSpecialCharacters | Checks if a string contains special characters.                     |\n| hasUppercase         | Checks if a string contains uppercase characters.                   |\n| hasLowercase         | Checks if a string contains lowercase characters.                   |\n| hasNumeric           | Checks if a string contains numeric characters.                     |\n| hasWhitespace        | Checks if a string contains whitespace characters.                  |\n| isString             | Checks if a value is a string.                                      |\n\n## Contribution\n\nContributions are welcome! If you'd like to contribute to `utility-validate`, please follow these guidelines:\n\n- Fork the repository on GitHub.\n- Clone your forked repository (`git clone https://github.com/blckclov3r/utility-validate`).\n- Create a new branch for your changes (`git checkout -b your-branch-name`).\n- Make your changes.\n- Commit your changes (`git commit -am 'Description of your changes'`).\n- Push your changes to your branch (`git push origin your-branch-name`).\n- Create a Pull Request on GitHub.\n\n## License\n\nMIT \u0026copy; [blckclov3r](https://github.com/blckclov3r/utility-validate?tab=MIT-1-ov-file)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblckclov3r%2Futility-validate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblckclov3r%2Futility-validate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblckclov3r%2Futility-validate/lists"}