{"_id":"@bakemono-san/utilities","name":"@bakemono-san/utilities","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"type":"module","name":"@bakemono-san/utilities","version":"1.0.0","description":"this is a lightweight and modular library providing a comprehensive set of utility functions to streamline development workflows. It is designed to simplify common tasks in software projects, including string manipulation, array operations, date handling,","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/Bakemono-san/utilities.git"},"keywords":["utils","string","array","object","text-processing","text"],"author":{"name":"Bakemono-san"},"license":"ISC","bugs":{"url":"https://github.com/Bakemono-san/utilities/issues"},"homepage":"https://github.com/Bakemono-san/utilities#readme","_id":"@bakemono-san/utilities@1.0.0","gitHead":"61f68c9865efcb3a8c11c2b55b3b29fff69e88a5","_nodeVersion":"20.13.1","_npmVersion":"10.8.3","dist":{"integrity":"sha512-39gIkFGbPnWbW1flhHZjtlIUpufhktVp+TKa7pDiqc666jN+INrYKAEBMnfSo9FUKbvgOeDT2y298RrzIUMN3g==","shasum":"28952a8a045baf63234509193acde5b71d8f4f04","tarball":"https://registry.npmjs.org/@bakemono-san/utilities/-/utilities-1.0.0.tgz","fileCount":6,"unpackedSize":18939,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDG2Ktb+tCxlc359lWJY3BwohdNCLOvo5C7c3zzQG02bQIhAJFjYImXyc25LvBRgji8GDc5iqbiiAzpZ8HtriKGxMWZ"}]},"_npmUser":{"name":"bakemono-san","email":"mousdef34@gmail.com"},"directories":{},"maintainers":[{"name":"bakemono-san","email":"mousdef34@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/utilities_1.0.0_1736624205283_0.8707184238988375"},"_hasShrinkwrap":false}},"time":{"created":"2025-01-11T19:36:45.202Z","1.0.0":"2025-01-11T19:36:45.468Z","modified":"2025-01-11T19:36:45.733Z"},"maintainers":[{"name":"bakemono-san","email":"mousdef34@gmail.com"}],"description":"this is a lightweight and modular library providing a comprehensive set of utility functions to streamline development workflows. It is designed to simplify common tasks in software projects, including string manipulation, array operations, date handling,","homepage":"https://github.com/Bakemono-san/utilities#readme","keywords":["utils","string","array","object","text-processing","text"],"repository":{"type":"git","url":"git+https://github.com/Bakemono-san/utilities.git"},"author":{"name":"Bakemono-san"},"bugs":{"url":"https://github.com/Bakemono-san/utilities/issues"},"license":"ISC","readme":"# @bakemono-san/utilities\n\nA collection of reusable utility functions for JavaScript projects. These functions simplify common programming tasks like string manipulation, array operations, date handling, number calculations, and object processing. Designed for efficiency and reusability.\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Features](#features)\n- [Usage](#usage)\n- [API Documentation](#api-documentation)\n  - [String Utilities](#string-utilities)\n  - [Array Utilities](#array-utilities)\n  - [Date Utilities](#date-utilities)\n- [Development](#development)\n  - [Cloning the Repository](#cloning-the-repository)\n  - [Running Tests](#running-tests)\n  - [Testing Locally](#testing-locally)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Installation\n\nInstall the package using npm:\n\n```bash\nnpm install @bakemono-san/utilities\n```\n\nOr link it locally for development:\n\n```bash\nnpm link\n```\n\n## Features\n\n- **String Utilities**: Functions for transforming and validating strings.\n- **Array Utilities**: Helpers for array manipulation.\n- **Date Utilities**: Tools for working with dates and times.\n- **Number Utilities**: Functions for number calculations and validation.\n- **Object Utilities**: Helpers for deep merging, cloning, and more.\n\n## Usage\n\n### Importing Functions\n\nIf you are using ES Modules (ESM):\n\n```javascript\nimport { capitalize } from '@bakemono-san/utilities';\n\nconsole.log(capitalize('hello world')); // Output: Hello world\n```\n\nIf you are using CommonJS:\n\n```javascript\nconst { capitalize } = require('@bakemono-san/utilities');\n\nconsole.log(capitalize('hello world')); // Output: Hello world\n```\n\n## API Documentation\n\n### String Utilities\n\n#### `capitalize(str)`\n\nCapitalizes the first letter of a string.\n\n```javascript\ncapitalize('hello'); // Returns: 'Hello'\n```\n\n**Parameters:**\n\n- `str` (string): The string to capitalize.\n\n**Returns:**\n\n- (string): The capitalized string.\n\n**Throws:**\n\n- `TypeError`: If the input is not a string.\n\n#### `toSnakeCase(str)`\n\nConverts the given string to snake_case.\n\n```javascript\ntoSnakeCase('Hello World'); // Returns: 'hello_world'\n```\n\n**Parameters:**\n\n- `str` (string): The string to convert.\n\n**Returns:**\n\n- (string): The snake_cased string.\n\n**Throws:**\n\n- `TypeError`: If the input is not a string.\n\n#### `reverseString(str)`\n\nReverses the given string.\n\n```javascript\nreverseString('hello'); // Returns: 'olleh'\n```\n\n**Parameters:**\n\n- `str` (string): The string to reverse.\n\n**Returns:**\n\n- (string): The reversed string.\n\n**Throws:**\n\n- `TypeError`: If the input is not a string.\n\n#### `isPalindrome(str)`\n\nChecks if a string is a palindrome.\n\n```javascript\nisPalindrome('racecar'); // Returns: true\n```\n\n**Parameters:**\n\n- `str` (string): The string to check.\n\n**Returns:**\n\n- (boolean): True if the string is a palindrome, false otherwise.\n\n**Throws:**\n\n- `TypeError`: If the input is not a string.\n\n### Array Utilities\n\n#### `removeDuplicates(arr)`\n\nRemoves duplicate values from an array.\n\n```javascript\nremoveDuplicates([1, 2, 2, 3, 3, 3]); // Returns: [1, 2, 3]\nremoveDuplicates(['a', 'a', 'b']); // Returns: ['a', 'b']\n```\n\n**Parameters:**\n\n- `arr` (Array): The array from which to remove duplicates.\n\n**Returns:**\n\n- (Array): A new array with duplicates removed.\n\n**Throws:**\n\n- `TypeError`: If the input is not an array.\n\n#### `flattenArray(arr)`\n\nFlattens a nested array.\n\n```javascript\nflattenArray([1, [2, [3, [4]]]]); // Returns: [1, 2, 3, 4]\nflattenArray(['a', ['b', ['c']]]); // Returns: ['a', 'b', 'c']\n```\n\n**Parameters:**\n\n- `arr` (Array): The array to flatten.\n\n**Returns:**\n\n- (Array): A new flattened array.\n\n**Throws:**\n\n- `TypeError`: If the input is not an array.\n\n#### `findMax(arr)`\n\nFinds the maximum value in an array.\n\n```javascript\nfindMax([1, 2, 3, 4]); // Returns: 4\nfindMax([10, 5, 8, 3]); // Returns: 10\n```\n\n**Parameters:**\n\n- `arr` (Array): The array to search for the maximum value.\n\n**Returns:**\n\n- (number): The maximum value in the array.\n\n**Throws:**\n\n- `TypeError`: If the input is not an array.\n\n#### `chunkArray(arr, size)`\n\nSplits an array into chunks of a specified size.\n\n```javascript\nchunkArray([1, 2, 3, 4, 5], 2); // Returns: [[1, 2], [3, 4], [5]]\nchunkArray(['a', 'b', 'c', 'd'], 3); // Returns: [['a', 'b', 'c'], ['d']]\n```\n\n**Parameters:**\n\n- `arr` (Array): The array to split into chunks.\n- `size` (number): The size of each chunk.\n\n**Returns:**\n\n- (Array): A new array with the original array split into chunks.\n\n**Throws:**\n\n- `TypeError`: If the first parameter is not an array or the second parameter is not a number.\n\n#### `findMin(arr)`\n\nFinds the minimum value in an array.\n\n```javascript\nfindMin([1, 2, 3, 4]); // Returns: 1\nfindMin([10, 5, 8, 3]); // Returns: 3\n```\n\n**Parameters:**\n\n- `arr` (Array): The array to search for the minimum value.\n\n**Returns:**\n\n- (number): The minimum value in the array.\n\n**Throws:**\n\n- `TypeError`: If the input is not an array.\n\n#### `sumArray(arr)`\n\nSums all the values in an array.\n\n```javascript\nsumArray([1, 2, 3, 4]); // Returns: 10\nsumArray([5, 5, 5]); // Returns: 15\n```\n\n**Parameters:**\n\n- `arr` (Array): The array to sum.\n\n**Returns:**\n\n- (number): The sum of all values in the array.\n\n**Throws:**\n\n- `TypeError`: If the input is not an array.\n\n#### `averageArray(arr)`\n\nCalculates the average of all values in an array.\n\n```javascript\naverageArray([1, 2, 3, 4]); // Returns: 2.5\naverageArray([5, 5, 5, 5]); // Returns: 5\n```\n\n**Parameters:**\n\n- `arr` (Array): The array to calculate the average.\n\n**Returns:**\n\n- (number): The average of all values in the array.\n\n**Throws:**\n\n- `TypeError`: If the input is not an array.\n\n#### `uniqueArray(arr)`\n\nFilters out duplicate values from an array.\n\n```javascript\nuniqueArray([1, 2, 2, 3, 3, 3]); // Returns: [1, 2, 3]\nuniqueArray(['a', 'a', 'b']); // Returns: ['a', 'b']\n```\n\n**Parameters:**\n\n- `arr` (Array): The array to filter for unique values.\n\n**Returns:**\n\n- (Array): A new array with only unique values.\n\n**Throws:**\n\n- `TypeError`: If the input is not an array.\n\n#### `arrayDifference(arr1, arr2)`\n\nComputes the difference between two arrays.\n\n```javascript\narrayDifference([1, 2, 3], [2, 4]); // Returns: [1, 3]\narrayDifference(['a', 'b'], ['b', 'c']); // Returns: ['a']\n```\n\n**Parameters:**\n\n- `arr1` (Array): The first array.\n- `arr2` (Array): The second array.\n\n**Returns:**\n\n- (Array): A new array with elements from the first array that are not in the second array.\n\n**Throws:**\n\n- `TypeError`: If either input is not an array.\n\n### Date Utilities\n\n#### `formatDate(date)`\n\nFormats a given date object into a string in the format 'YYYY-MM-DD'.\n\n```javascript\nformatDate(new Date()); // Returns: '2025-01-11'\n```\n\n#### `getDaysDifference(date1, date2)`\n\nCalculates the absolute difference in days between two dates.\n\n```javascript\ngetDaysDifference('2025-01-01', '2025-01-11'); // Returns: 10\n```\n\n#### `isWeekend(date)`\n\nChecks if a given date falls on a weekend (Saturday or Sunday).\n\n```javascript\nisWeekend('2025-01-11'); // Returns: true\n```\n\n#### `getDay(date)`\n\nGets the day of the month from a given date.\n\n```javascript\ngetDay('2025-01-11'); // Returns: 11\n```\n\n#### `getMonth(date)`\n\nGets the month from a given date.\n\n```javascript\ngetMonth('2025-01-11'); // Returns: 1\n```\n\n#### `getYear(date)`\n\nGets the year from a given date.\n\n```javascript\ngetYear('2025-01-11'); // Returns: 2025\n```\n\n## Development\n\n### Cloning the Repository\n\nClone the repository locally:\n\n```bash\ngit clone https://github.com/bakemono-san/utilities.git\n```\n\n### Running Tests\n\nInstall the dependencies:\n\n```bash\nnpm install\n```\n\nRun the tests:\n\n```bash\nnpm test\n```\n\n### Testing Locally\n\nUse `npm link` to test your package locally:\n\n```bash\nnpm link\ncd path/to/your/test/project\nnpm link @bakemono-san/utilities\n```\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request for any changes or suggestions.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.\n\n---\n","readmeFilename":"README.md"}