{"_id":"@7uan/utils","_rev":"3-9b5d6f0f36ddf487f19ac30b81185ac7","name":"@7uan/utils","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"@7uan/utils","version":"1.0.0","keywords":["dayjs","http-status-code","dayjs-utils","lodash"],"author":{"name":"TuanNA","email":"tuanna.fed@gmail.com"},"license":"ISC","_id":"@7uan/utils@1.0.0","maintainers":[{"name":"7tuanna","email":"tuanna.fed@gmail.com"}],"homepage":"https://github.com/tuannafed/7uan#readme","bugs":{"url":"https://github.com/tuannafed/7uan/issues"},"dist":{"shasum":"22d1f8a28eeeee519a8125a891bd2e85f8e3b702","tarball":"https://registry.npmjs.org/@7uan/utils/-/utils-1.0.0.tgz","fileCount":4,"integrity":"sha512-q3YPDy8VkLXudhDBeJE7HkrbGVioKWQKojZZ+rDVf0+3Yys+cNPmiI+74u/QiClFxG0/CnvKvBHUusV6nR/DFA==","signatures":[{"sig":"MEQCIGRmS4BUJm1mZZq5OFHmFXeBdh/4IDHStC+FldwuhQD8AiB+iRO7nill3XjJiVm2lKDE/oK5jtgMs/7KB89fbl/xIg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":160882},"main":"./dist/index.js","type":"module","_from":"file:7uan-utils-1.0.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=18.18.0"},"exports":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"private":false,"scripts":{"dev":"tsup --watch","lint":"eslint . --fix && tsc --noEmit","test":"vitest run","build":"tsup","clean":"rimraf dist node_modules","format":"prettier --write './**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc","test:watch":"vitest"},"_npmUser":{"name":"7tuanna","email":"tuanna.fed@gmail.com"},"_resolved":"/private/var/folders/z0/mnc3cd717_j5jp5633tj_v2c0000gn/T/b04339d029aff05079780b02366d219e/7uan-utils-1.0.0.tgz","_integrity":"sha512-q3YPDy8VkLXudhDBeJE7HkrbGVioKWQKojZZ+rDVf0+3Yys+cNPmiI+74u/QiClFxG0/CnvKvBHUusV6nR/DFA==","repository":{"url":"git+https://github.com/tuannafed/7uan.git","type":"git"},"_npmVersion":"10.1.0","description":"This is the repository to make some utils functions, re-libraries, helpers, constants, types, etc...","directories":{"test":"tests"},"sideEffects":false,"_nodeVersion":"20.9.0","dependencies":{"dayjs":"^1.11.13"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"qs":"^6.13.1","tsup":"^8.3.5","eslint":"^9.17.0","lodash":"^4.17.21","vitest":"^2.1.8","ts-node":"^10.9.2","prettier":"^3.4.2","@types/qs":"^6.9.17","colorette":"^2.0.20","typescript":"^5.6.3","@types/lodash":"^4.17.14","markdown-table":"^3.0.4","@types/fs-extra":"^11.0.4","@edge-runtime/vm":"^5.0.0","@repo/eslint-config":"^1.0.0","eslint-plugin-jsdoc":"^50.6.1","@repo/typescript-config":"^0.0.0","eslint-plugin-tree-shaking":"^1.12.2"},"_npmOperationalInternal":{"tmp":"tmp/utils_1.0.0_1745478287811_0.07320944914778904","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@7uan/utils","version":"1.1.0","keywords":["dayjs","http-status-code","dayjs-utils","lodash"],"author":{"name":"TuanNA","email":"tuanna.fed@gmail.com"},"license":"ISC","_id":"@7uan/utils@1.1.0","maintainers":[{"name":"7tuanna","email":"tuanna.fed@gmail.com"}],"homepage":"https://github.com/tuannafed/7uan#readme","bugs":{"url":"https://github.com/tuannafed/7uan/issues"},"dist":{"shasum":"af058ac45e88ef05fbebe3f3f7bf6fc2ec9638bf","tarball":"https://registry.npmjs.org/@7uan/utils/-/utils-1.1.0.tgz","fileCount":4,"integrity":"sha512-CdQUkno2T4+Dn1jLm9dNMPaUOo6xWQ7n9w1ntI75tSLIGbbjcTnqcqSREHiWHNtyyHAnPlIJtzduyx7lNyX7Eg==","signatures":[{"sig":"MEYCIQCfyNI9A4NwgaH5x5+Vqt7PGKkdBMuL2wGFEhl3io3/6wIhAOPLDct54Nk+9hI93oQSvt97Q2As9+Mjnb2/0ko6vq3J","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":164362},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18.18.0"},"exports":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"gitHead":"f6ae472d93d92022f18db8197df4070d405b88e4","private":false,"scripts":{"dev":"tsup --watch","lint":"eslint . --fix && tsc --noEmit","test":"vitest run","build":"tsup","clean":"rimraf dist node_modules","format":"prettier --write './**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc","lint:fix":"eslint . --fix && tsc --noEmit","test:watch":"vitest","generate-docs":"npx tsx scripts/generate.ts"},"_npmUser":{"name":"7tuanna","email":"tuanna.fed@gmail.com"},"repository":{"url":"git+https://github.com/tuannafed/7uan.git","type":"git"},"_npmVersion":"10.1.0","description":"This is the repository to make some utils functions, re-libraries, helpers, constants, types, etc...","directories":{"test":"tests"},"sideEffects":false,"_nodeVersion":"20.9.0","dependencies":{"dayjs":"^1.11.13"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"qs":"^6.13.1","tsup":"^8.3.5","eslint":"^9.17.0","lodash":"^4.17.21","vitest":"^2.1.8","ts-node":"^10.9.2","prettier":"^3.4.2","@types/qs":"^6.9.17","colorette":"^2.0.20","typescript":"^5.6.3","@types/lodash":"^4.17.14","markdown-table":"^3.0.4","@types/fs-extra":"^11.0.4","@edge-runtime/vm":"^5.0.0","@repo/eslint-config":"workspace:^","eslint-plugin-jsdoc":"^50.6.1","@repo/typescript-config":"workspace:^","eslint-plugin-tree-shaking":"^1.12.2"},"_npmOperationalInternal":{"tmp":"tmp/utils_1.1.0_1745549344202_0.3228797202513871","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@7uan/utils","version":"1.1.1","private":false,"sideEffects":false,"description":"This is the repository to make some utils functions, re-libraries, helpers, constants, types, etc...","keywords":["dayjs","http-status-code","dayjs-utils","lodash"],"author":{"name":"TuanNA","email":"tuanna.fed@gmail.com"},"license":"ISC","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{"import":"./dist/index.js","types":"./dist/index.d.ts"},"publishConfig":{"access":"public"},"scripts":{"build":"tsup --minify --sourcemap --dts --clean --format esm,cjs --splitting --treeshake","dev":"tsup --watch","test":"vitest run","test:watch":"vitest","lint":"eslint . --fix && tsc --noEmit","lint:fix":"eslint . --fix && tsc --noEmit","format":"prettier --write './**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc","clean":"rimraf dist node_modules","generate-docs":"npx tsx scripts/generate.ts"},"dependencies":{"dayjs":"^1.11.13"},"devDependencies":{"@edge-runtime/vm":"^5.0.0","@repo/eslint-config":"workspace:^","@repo/typescript-config":"workspace:^","@types/fs-extra":"^11.0.4","@types/lodash":"^4.17.14","@types/qs":"^6.9.17","colorette":"^2.0.20","eslint":"^9.17.0","eslint-plugin-jsdoc":"^50.6.1","eslint-plugin-tree-shaking":"^1.12.2","lodash":"^4.17.21","markdown-table":"^3.0.4","prettier":"^3.4.2","qs":"^6.13.1","ts-node":"^10.9.2","tsup":"^8.3.5","typescript":"^5.6.3","vitest":"^2.1.8"},"engines":{"node":">=18.18.0"},"repository":{"type":"git","url":"git+https://github.com/tuannafed/7uan.git"},"bugs":{"url":"https://github.com/tuannafed/7uan/issues"},"directories":{"test":"tests"},"_id":"@7uan/utils@1.1.1","gitHead":"4fd03b8391b29e00cea316a7f48361f8dcc913e8","homepage":"https://github.com/tuannafed/7uan#readme","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-Ytn4tN7hi808yZo7KoWHLab/vwWxSpTC8c8Utn93UUVVTye1zgUfUkvitFDnlArK1RFSxzBR3a1s1MAJBYcuiw==","shasum":"4fb818bcf96a6d0d54ca016e25df347c86382802","tarball":"https://registry.npmjs.org/@7uan/utils/-/utils-1.1.1.tgz","fileCount":8,"unpackedSize":694588,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIBeB37vFLCNAYX4r3uJ4TrjOEe3DyXbxIBGcIcDy/Gp/AiAFUsZLbQglGAGkYfGwu8GB76J3PHe+rJrxtIb/2m++Pw=="}]},"_npmUser":{"name":"7tuanna","email":"tuanna.fed@gmail.com"},"maintainers":[{"name":"7tuanna","email":"tuanna.fed@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/utils_1.1.1_1745549675369_0.985773287932763"},"_hasShrinkwrap":false}},"time":{"created":"2025-04-24T07:04:47.706Z","modified":"2025-04-25T02:54:35.795Z","1.0.0":"2025-04-24T07:04:47.992Z","1.1.0":"2025-04-25T02:49:04.380Z","1.1.1":"2025-04-25T02:54:35.581Z"},"bugs":{"url":"https://github.com/tuannafed/7uan/issues"},"author":{"name":"TuanNA","email":"tuanna.fed@gmail.com"},"license":"ISC","homepage":"https://github.com/tuannafed/7uan#readme","keywords":["dayjs","http-status-code","dayjs-utils","lodash"],"repository":{"type":"git","url":"git+https://github.com/tuannafed/7uan.git"},"description":"This is the repository to make some utils functions, re-libraries, helpers, constants, types, etc...","maintainers":[{"name":"7tuanna","email":"tuanna.fed@gmail.com"}],"readme":"# 📦 @7uan/utils\n\nA collection of utility functions to simplify common JavaScript/TypeScript operations.\n\n## 📑 Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Functions](#functions)\n  - [convertObjectKeysToCamelCase](#convertobjectkeystocamelcase)\n  - [convertObjectKeysToSnakeCase](#convertobjectkeystosnakecase)\n  - [convertToSlug](#converttoslug)\n  - [formatCurrency](#formatcurrency)\n  - [formatQueryString](#formatquerystring)\n  - [getFileInfo](#getfileinfo)\n  - [getReasonPhrase](#getreasonphrase)\n  - [getStatusCode](#getstatuscode)\n  - [removeEmptyQueryParams](#removeemptyqueryparams)\n  - [sleep](#sleep)\n- [Contributing](#contributing)\n- [License](#license)\n\n## ⚙️ Installation\n\n```sh\nnpm install @7uan/utils\n```\n\nor using Yarn:\n\n```sh\nyarn add @7uan/utils\n```\n\nor using pnpm:\n\n```sh\npnpm add @7uan/utils\n```\n\n## 🚀 Usage\n\n```ts\nimport {\n  convertObjectKeysToCamelCase,\n  convertObjectKeysToSnakeCase,\n  convertToSlug,\n  formatCurrency,\n  formatQueryString,\n  getFileInfo,\n  getReasonPhrase,\n  getStatusCode,\n  removeEmptyQueryParams,\n  sleep,\n} from '@7uan/utils'\n```\n\n## 🔧 Functions\n\n### convertObjectKeysToCamelCase\n\nConvert object keys from snake_case to camelCase.\n\n**Parameters:**\n\n- data The object or array of objects to process. It can be any object or array of objects.\n\n**Returns:** ConvertObjectKeysToCamelCaseReturnType The transformed result, which is a string.\n\n**Example:**\n\n```tsx\nconst result = convertObjectKeysToCamelCase([{ snake_case_key: 'value' }])\n\nconsole.log(result) // \"Processed output\"\n```\n\n### convertObjectKeysToSnakeCase\n\nConvert object keys to snake case.\n\n**Parameters:**\n\n- data The object or array of objects to process. It can be any object or array of objects.\n\n**Returns:** ConvertObjectKeysToSnakeCaseReturnType The transformed result, which is a string.\n\n**Example:**\n\n```tsx\nconst result = convertObjectKeysToSnakeCase([{ snake_case_key: 'value' }])\n\nconsole.log(result) // \"Processed output\"\n```\n\n### convertToSlug\n\nConvert a string to a slug.\n\n**Parameters:**\n\n- text The text to be transformed.\n\n**Returns:** The slug.\n\n**Example:**\n\n```tsx\nconst text = 'Hello World'\nconst slug = convertToSlug(text)\nconsole.log(slug) // hello-world\n```\n\n### formatCurrency\n\nFormats a number into a currency string.\n\n**Parameters:**\n\n- amount The number to format.\n- locale The locale to use. Default is `en-US`.\n- currency The currency to use. Default is `USD`.\n\n**Returns:** Returns the formatted currency string.\n\n**Example:**\n\n```tsx\nconst amount = 1000\nconst locale = 'en-US'\nconst currency = 'USD'\nconst result = formatCurrency(amount, locale, currency)\nconsole.log(result)\n// => $1,000.00\n```\n\n### formatQueryString\n\nFormats a URL with path parameters and query parameters.\n\n- `pathParams` (string | number | (string | number)[]): The path parameters to be appended to the baseUrl.\n- `query` (Record<string, any>): The query parameters to be appended to the URL as a query string.\n\n**Parameters:**\n\n- - `baseUrl` (string): The base URL to which the pathParams and query parameters will be appended.\n\n**Returns:** FormatQueryStringReturnType The transformed result, which is a string.\n\n**Example:**\n\n```tsx\nconst result = formatQueryString([{ snake_case_key: 'value' }])\n\nconsole.log(result) // \"Processed output\"\n```\n\n### getFileInfo\n\nType for file information result\n\n**Example:**\n\n```tsx\nconst file = new File(['content'], 'example.jpg')\nconst fileName = getFileInfo.name(file.name)\nconst extension = getFileInfo.extension(file.name)\nconst size = getFileInfo.size(file.size)\nconst { width, height } = await getFileInfo.dimensions(file)\nconst info = await getFileInfo.all(file)\n\nconsole.log(info) // { name: 'example', extension: 'jpg', size: '8 Bytes', width: 0, height: 0 }\n```\n\n### getReasonPhrase\n\nReturns the reason phrase for the given status code.\nIf the given status code does not exist, an error is thrown.\n\n**Parameters:**\n\n- statusCode The HTTP status code\n\n**Returns:** The associated reason phrase (e.g. \"Bad Request\", \"OK\")\n\n**Example:**\n\n```ts\nconst reasonPhrase = getReasonPhrase(404)\nconsole.log(reasonPhrase) // \"Not Found\"\n```\n\n### getStatusCode\n\nReturns the status code for the given reason phrase.\nIf the given reason phrase does not exist, undefined is returned.\n\n**Parameters:**\n\n- reasonPhrase The HTTP reason phrase (e.g. \"Bad Request\", \"OK\")\n\n**Returns:** The associated status code\n\n**Example:**\n\n```ts\nconst statusCode = getStatusCode('Not Found')\nconsole.log(statusCode) // 404\n```\n\n### removeEmptyQueryParams\n\nRemoves empty query parameters from an object or array of objects.\n\n**Parameters:**\n\n- data The object or array of objects to process. It can be any object or array of objects.\n\n**Returns:** RemoveEmptyQueryParamsReturnType The transformed result, which is a string.\n\n**Example:**\n\n```tsx\nconst result = removeEmptyQueryParams([{ snake_case_key: 'value' }])\n\nconsole.log(result) // \"Processed output\"\n```\n\n### sleep\n\nSleep for the specified number of seconds.\n\n**Parameters:**\n\n- data The object or array of objects to process. It can be any object or array of objects.\n\n**Returns:** Returns a promise that resolves after the specified number of seconds.\n\n**Example:**\n\n```tsx\nconst result = sleep([{ snake_case_key: 'value' }])\n\nconsole.log(result) // \"Processed output\"\n```\n\n## 🤝 Contributing\n\nContributions are welcome! Please open an issue or submit a pull request.\n\n## 📄 License\n\nMIT\n","readmeFilename":"README.md"}