{"_id":"@akaoio/util","_rev":"3-d2945820e69f510c178916678e848ce2","name":"@akaoio/util","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@akaoio/util","version":"1.0.0","keywords":["utility","utils","helper","typescript","nodejs","browser","akaoio"],"author":{"name":"akaoio"},"license":"MIT","_id":"@akaoio/util@1.0.0","maintainers":[{"name":"akaoio","email":"dev@akao.io"}],"homepage":"https://github.com/akaoagent/util#readme","bugs":{"url":"https://github.com/akaoagent/util/issues"},"dist":{"shasum":"c1262347e35b5a3512e17162e39ab5d70bf0a219","tarball":"https://registry.npmjs.org/@akaoio/util/-/util-1.0.0.tgz","fileCount":92,"integrity":"sha512-bFw2wg7vNxeEbKKrq38HkA6PV37K0bMvwpkQwQK2GNqHqMWtZ+TeCqehfD+34hpwC7HzEzW6YBkeXSJybKIKDQ==","signatures":[{"sig":"MEUCIQCfsj+TEwp6pRiPe4TvBfxDdmvoLsLxDz82aF88Jqmd7AIgJ88+r29X8Gg7uFsfEDkVqyUKce749JX53qoCjbg1VxI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":405027},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/esm/index.js","browser":"dist/browser/index.js","engines":{"node":">=14.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/esm/index.js","browser":"./dist/browser/index.js","require":"./dist/index.js"},"./url":{"types":"./dist/url/index.d.ts","import":"./dist/esm/url/index.js","require":"./dist/url/index.js"},"./date":{"types":"./dist/date/index.d.ts","import":"./dist/esm/date/index.js","require":"./dist/date/index.js"},"./file":{"types":"./dist/file/index.d.ts","import":"./dist/esm/file/index.js","require":"./dist/file/index.js"},"./array":{"types":"./dist/array/index.d.ts","import":"./dist/esm/array/index.js","require":"./dist/array/index.js"},"./crypto":{"types":"./dist/crypto/index.d.ts","import":"./dist/esm/crypto/index.js","require":"./dist/crypto/index.js"},"./number":{"types":"./dist/number/index.d.ts","import":"./dist/esm/number/index.js","require":"./dist/number/index.js"},"./object":{"types":"./dist/object/index.d.ts","import":"./dist/esm/object/index.js","require":"./dist/object/index.js"},"./random":{"types":"./dist/random/index.d.ts","import":"./dist/esm/random/index.js","require":"./dist/random/index.js"},"./string":{"types":"./dist/string/index.d.ts","import":"./dist/esm/string/index.js","require":"./dist/string/index.js"},"./validation":{"types":"./dist/validation/index.d.ts","import":"./dist/esm/validation/index.js","require":"./dist/validation/index.js"}},"gitHead":"26d7f90c05b40cd61e35ee4d198a20c3b4ac56c6","scripts":{"lint":"eslint src --ext .ts","test":"jest","build":"npm run clean && npm run build:cjs && npm run build:esm && npm run build:browser","clean":"rm -rf dist","format":"prettier --write \"src/**/*.ts\"","prepare":"npm run build","lint:fix":"eslint src --ext .ts --fix","build:cjs":"tsc","build:esm":"tsc -p tsconfig.esm.json","typecheck":"tsc --noEmit","test:watch":"jest --watch","build:browser":"webpack --config webpack.config.js","test:coverage":"jest --coverage","prepublishOnly":"npm run build && npm run test"},"_npmUser":{"name":"akaoio","email":"dev@akao.io"},"repository":{"url":"git+https://github.com/akaoagent/util.git","type":"git"},"_npmVersion":"9.2.0","description":"A comprehensive TypeScript utility library for Node.js and browser environments","directories":{},"_nodeVersion":"18.19.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","eslint":"^8.57.0","ts-jest":"^29.1.2","webpack":"^5.91.0","prettier":"^3.2.5","ts-loader":"^9.5.1","typescript":"^5.4.3","@types/jest":"^29.5.12","@types/node":"^20.11.30","webpack-cli":"^5.1.4","eslint-config-prettier":"^9.1.0","@typescript-eslint/parser":"^7.3.1","@typescript-eslint/eslint-plugin":"^7.3.1"},"_npmOperationalInternal":{"tmp":"tmp/util_1.0.0_1755666940474_0.27213380021713696","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@akaoio/util","version":"1.0.1","keywords":["utility","utils","helper","typescript","nodejs","browser","akaoio"],"author":{"name":"akaoio"},"license":"MIT","_id":"@akaoio/util@1.0.1","maintainers":[{"name":"akaoio","email":"dev@akao.io"}],"homepage":"https://github.com/akaoio/util#readme","bugs":{"url":"https://github.com/akaoio/util/issues"},"dist":{"shasum":"c75aa97368fcadba37d20a197d1ccfe0184eecb6","tarball":"https://registry.npmjs.org/@akaoio/util/-/util-1.0.1.tgz","fileCount":92,"integrity":"sha512-fEHHAz77H8FACVNX+K7wrtw/RT9j913mVSyU3fqeKmrHOJ7kWS+0ERO3/nQ97DiDUuGPpFdWXaz89xwV9oTZqg==","signatures":[{"sig":"MEUCIDGm3xzPGphnUPnS5TK1Ncw6tobfAzn3AonUcuqpoTwCAiEAqxH9061BDldpLWtMq5RGg7Fjk1xWYR2sqbzl/25VEXM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":405019},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/esm/index.js","browser":"dist/browser/index.js","engines":{"node":">=14.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/esm/index.js","browser":"./dist/browser/index.js","require":"./dist/index.js"},"./url":{"types":"./dist/url/index.d.ts","import":"./dist/esm/url/index.js","require":"./dist/url/index.js"},"./date":{"types":"./dist/date/index.d.ts","import":"./dist/esm/date/index.js","require":"./dist/date/index.js"},"./file":{"types":"./dist/file/index.d.ts","import":"./dist/esm/file/index.js","require":"./dist/file/index.js"},"./array":{"types":"./dist/array/index.d.ts","import":"./dist/esm/array/index.js","require":"./dist/array/index.js"},"./crypto":{"types":"./dist/crypto/index.d.ts","import":"./dist/esm/crypto/index.js","require":"./dist/crypto/index.js"},"./number":{"types":"./dist/number/index.d.ts","import":"./dist/esm/number/index.js","require":"./dist/number/index.js"},"./object":{"types":"./dist/object/index.d.ts","import":"./dist/esm/object/index.js","require":"./dist/object/index.js"},"./random":{"types":"./dist/random/index.d.ts","import":"./dist/esm/random/index.js","require":"./dist/random/index.js"},"./string":{"types":"./dist/string/index.d.ts","import":"./dist/esm/string/index.js","require":"./dist/string/index.js"},"./validation":{"types":"./dist/validation/index.d.ts","import":"./dist/esm/validation/index.js","require":"./dist/validation/index.js"}},"gitHead":"1abe990359c58b76bf95416052105137d71dd721","scripts":{"lint":"eslint src --ext .ts","test":"jest","build":"npm run clean && npm run build:cjs && npm run build:esm && npm run build:browser","clean":"rm -rf dist","format":"prettier --write \"src/**/*.ts\"","prepare":"npm run build","lint:fix":"eslint src --ext .ts --fix","build:cjs":"tsc","build:esm":"tsc -p tsconfig.esm.json","typecheck":"tsc --noEmit","test:watch":"jest --watch","build:browser":"webpack --config webpack.config.js","test:coverage":"jest --coverage","prepublishOnly":"npm run build && npm run test"},"_npmUser":{"name":"akaoio","email":"dev@akao.io"},"repository":{"url":"git+https://github.com/akaoio/util.git","type":"git"},"_npmVersion":"9.2.0","description":"A comprehensive TypeScript utility library for Node.js and browser environments","directories":{},"_nodeVersion":"18.19.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","eslint":"^8.57.0","ts-jest":"^29.1.2","webpack":"^5.91.0","prettier":"^3.2.5","ts-loader":"^9.5.1","typescript":"^5.4.3","@types/jest":"^29.5.12","@types/node":"^20.11.30","webpack-cli":"^5.1.4","eslint-config-prettier":"^9.1.0","@typescript-eslint/parser":"^7.3.1","@typescript-eslint/eslint-plugin":"^7.3.1"},"_npmOperationalInternal":{"tmp":"tmp/util_1.0.1_1755668841264_0.8663766353982423","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@akaoio/util","version":"1.0.2","description":"A comprehensive TypeScript utility library for Node.js and browser environments","main":"dist/index.js","module":"dist/esm/index.js","types":"dist/index.d.ts","browser":"dist/browser/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/esm/index.js","require":"./dist/index.js","browser":"./dist/browser/index.js"},"./string":{"types":"./dist/string/index.d.ts","import":"./dist/esm/string/index.js","require":"./dist/string/index.js"},"./array":{"types":"./dist/array/index.d.ts","import":"./dist/esm/array/index.js","require":"./dist/array/index.js"},"./object":{"types":"./dist/object/index.d.ts","import":"./dist/esm/object/index.js","require":"./dist/object/index.js"},"./number":{"types":"./dist/number/index.d.ts","import":"./dist/esm/number/index.js","require":"./dist/number/index.js"},"./date":{"types":"./dist/date/index.d.ts","import":"./dist/esm/date/index.js","require":"./dist/date/index.js"},"./crypto":{"types":"./dist/crypto/index.d.ts","import":"./dist/esm/crypto/index.js","require":"./dist/crypto/index.js"},"./file":{"types":"./dist/file/index.d.ts","import":"./dist/esm/file/index.js","require":"./dist/file/index.js"},"./random":{"types":"./dist/random/index.d.ts","import":"./dist/esm/random/index.js","require":"./dist/random/index.js"},"./url":{"types":"./dist/url/index.d.ts","import":"./dist/esm/url/index.js","require":"./dist/url/index.js"},"./validation":{"types":"./dist/validation/index.d.ts","import":"./dist/esm/validation/index.js","require":"./dist/validation/index.js"}},"scripts":{"build":"npm run clean && npm run build:cjs && npm run build:esm && npm run build:browser","build:cjs":"tsc","build:esm":"tsc -p tsconfig.esm.json","build:browser":"webpack --config webpack.config.js","clean":"rm -rf dist","test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage","lint":"eslint src --ext .ts","lint:fix":"eslint src --ext .ts --fix","format":"prettier --write \"src/**/*.ts\"","typecheck":"tsc --noEmit","prepublishOnly":"npm run build && npm run test","prepare":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/akaoio/util.git"},"keywords":["utility","utils","helper","typescript","nodejs","browser","akaoio"],"author":{"name":"akaoio"},"license":"MIT","bugs":{"url":"https://github.com/akaoio/util/issues"},"homepage":"https://github.com/akaoio/util#readme","devDependencies":{"@types/jest":"^29.5.12","@types/node":"^20.11.30","@typescript-eslint/eslint-plugin":"^7.3.1","@typescript-eslint/parser":"^7.3.1","eslint":"^8.57.0","eslint-config-prettier":"^9.1.0","jest":"^29.7.0","prettier":"^3.2.5","ts-jest":"^29.1.2","ts-loader":"^9.5.1","typescript":"^5.4.3","webpack":"^5.91.0","webpack-cli":"^5.1.4"},"engines":{"node":">=14.0.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"gitHead":"453e18cb300dde47d7c2087222d3b2fcfca68ba2","_id":"@akaoio/util@1.0.2","_nodeVersion":"18.19.0","_npmVersion":"9.2.0","dist":{"integrity":"sha512-nkl/u1kqfq9hSyLx8SRUS+KD7T/EEOHz/hhIqtyJLr5h7/qV9E4L5L/Nv/Jhlb1pxlxTh/Qf/pEkCA6+spCR+w==","shasum":"a59ff62737e44f38b8984f6ac3cc6642cd36344d","tarball":"https://registry.npmjs.org/@akaoio/util/-/util-1.0.2.tgz","fileCount":92,"unpackedSize":416201,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDVdWboYZuWauNAplhgy5NpwMKlXwubjlqQAUH8wOSKcgIgeu2HWgRK8BmNxRERJx9iwDVAdHjn8mX4+SK1QbJU1n4="}]},"_npmUser":{"name":"akaoio","email":"dev@akao.io"},"directories":{},"maintainers":[{"name":"akaoio","email":"dev@akao.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/util_1.0.2_1755669223821_0.2889579466685659"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-20T05:15:40.353Z","modified":"2025-08-20T05:53:44.184Z","1.0.0":"2025-08-20T05:15:40.668Z","1.0.1":"2025-08-20T05:47:21.440Z","1.0.2":"2025-08-20T05:53:43.998Z"},"bugs":{"url":"https://github.com/akaoio/util/issues"},"author":{"name":"akaoio"},"license":"MIT","homepage":"https://github.com/akaoio/util#readme","keywords":["utility","utils","helper","typescript","nodejs","browser","akaoio"],"repository":{"type":"git","url":"git+https://github.com/akaoio/util.git"},"description":"A comprehensive TypeScript utility library for Node.js and browser environments","maintainers":[{"name":"akaoio","email":"dev@akao.io"}],"readme":"# @akaoio/util\n\n<p align=\"center\">\n  <a href=\"https://www.npmjs.com/package/@akaoio/util\"><img src=\"https://img.shields.io/npm/v/@akaoio/util.svg?style=flat-square\" alt=\"NPM version\"></a>\n  <a href=\"https://www.npmjs.com/package/@akaoio/util\"><img src=\"https://img.shields.io/npm/dm/@akaoio/util.svg?style=flat-square\" alt=\"NPM downloads\"></a>\n  <a href=\"https://github.com/akaoio/util/blob/main/LICENSE\"><img src=\"https://img.shields.io/npm/l/@akaoio/util.svg?style=flat-square\" alt=\"License\"></a>\n  <a href=\"https://github.com/akaoio/util\"><img src=\"https://img.shields.io/github/stars/akaoio/util?style=flat-square\" alt=\"GitHub stars\"></a>\n</p>\n\n> 🚀 Comprehensive TypeScript utility library for Node.js and browser environments\n\nA collection of 200+ well-tested, tree-shakeable utility functions that you'll use in every project. Built with TypeScript for perfect type safety and IntelliSense support.\n\n## ✨ Features\n\n- 📦 **200+ Utility Functions** - Everything from string manipulation to cryptography\n- 🌳 **Tree-shakeable** - Import only what you need, keep your bundle size small\n- 🔷 **TypeScript First** - Written in TypeScript with complete type definitions\n- 🌐 **Universal** - Works in Node.js, browsers, and Deno\n- ⚡ **Zero Dependencies** - No external dependencies, lightweight and fast\n- 🧪 **Well Tested** - Comprehensive test coverage\n- 📚 **Great Documentation** - Clear examples for every function\n\n## 📦 Installation\n\n```bash\nnpm install @akaoio/util\n```\n\n```bash\nyarn add @akaoio/util\n```\n\n```bash\npnpm add @akaoio/util\n```\n\n## 🚀 Quick Start\n\n### Import everything (not recommended for production)\n\n```typescript\nimport * as utils from '@akaoio/util';\n\nutils.string.capitalize('hello');  // 'Hello'\nutils.array.chunk([1,2,3,4], 2);  // [[1,2], [3,4]]\nutils.number.formatNumber(1234567.89);  // '1,234,567.89'\n```\n\n### Import specific modules (recommended)\n\n```typescript\nimport { string, array, number } from '@akaoio/util';\n\nstring.capitalize('hello');  // 'Hello'\narray.unique([1, 2, 2, 3]);  // [1, 2, 3]\nnumber.clamp(15, 0, 10);     // 10\n```\n\n### Import individual functions (best for tree-shaking)\n\n```typescript\nimport { capitalize, chunk, clamp } from '@akaoio/util';\n\ncapitalize('hello');     // 'Hello'\nchunk([1,2,3,4], 2);    // [[1,2], [3,4]]\nclamp(15, 0, 10);       // 10\n```\n\n### Direct module imports\n\n```typescript\nimport * as stringUtils from '@akaoio/util/string';\nimport * as arrayUtils from '@akaoio/util/array';\n```\n\n## 📚 Available Modules\n\n### 🔤 String Utilities\n\nTransform, validate, and manipulate strings with ease.\n\n```typescript\nimport { string } from '@akaoio/util';\n\n// Case conversion\nstring.toCamelCase('hello-world');   // 'helloWorld'\nstring.toSnakeCase('helloWorld');    // 'hello_world'\nstring.toKebabCase('hello world');   // 'hello-world'\n\n// Text manipulation\nstring.capitalize('hello');          // 'Hello'\nstring.truncate('long text', 5);    // 'long...'\nstring.slugify('Hello World!');      // 'hello-world'\n\n// Validation\nstring.isEmail('test@example.com');  // true\nstring.isUrl('https://example.com'); // true\n```\n\n**Full list:** `capitalize`, `toCamelCase`, `toSnakeCase`, `toKebabCase`, `truncate`, `slugify`, `shorten`, `removeAccents`, `escapeHtml`, `unescapeHtml`, `isEmail`, `isUrl`, `padStart`, `padEnd`, `repeat`, `reverse`, `countWords`, `countLines`, `spintax`\n\n### 📊 Array Utilities\n\nPowerful array manipulation and transformation functions.\n\n```typescript\nimport { array } from '@akaoio/util';\n\n// Transformation\narray.chunk([1,2,3,4,5,6], 2);      // [[1,2], [3,4], [5,6]]\narray.flatten([[1], [2, [3]]]);      // [1, 2, 3]\narray.unique([1, 2, 2, 3]);          // [1, 2, 3]\n\n// Operations\narray.difference([1,2,3], [2,3,4]);  // [1]\narray.intersection([1,2,3], [2,3,4]); // [2, 3]\narray.shuffle([1, 2, 3, 4]);         // [3, 1, 4, 2] (random)\n\n// Grouping & Sorting\narray.groupBy([{age: 20}, {age: 30}], x => x.age);\narray.sortBy(users, user => user.name);\n```\n\n**Full list:** `chunk`, `flatten`, `unique`, `uniqueBy`, `difference`, `intersection`, `union`, `shuffle`, `sample`, `sampleSize`, `groupBy`, `sortBy`, `partition`, `compact`, `range`, `zip`, `unzip`, `first`, `last`, `take`, `drop`, `sum`, `mean`, `median`, `min`, `max`\n\n### 🎯 Object Utilities\n\nDeep operations on objects with immutability in mind.\n\n```typescript\nimport { object } from '@akaoio/util';\n\n// Deep operations\nconst cloned = object.deepClone(original);\nconst merged = object.deepMerge(obj1, obj2);\n\n// Property manipulation\nobject.pick(user, ['name', 'email']);\nobject.omit(user, ['password']);\n\n// Path operations\nobject.get(user, 'address.city', 'default');\nobject.set(user, 'address.city', 'New York');\nobject.has(user, 'address.city');  // true\n\n// Comparison\nobject.isEqual(obj1, obj2);  // deep equality\nobject.isEmpty({});           // true\nobject.diff(oldObj, newObj);  // returns changes\n```\n\n**Full list:** `deepClone`, `deepMerge`, `pick`, `omit`, `get`, `set`, `has`, `isEmpty`, `isEqual`, `mapKeys`, `mapValues`, `invert`, `entries`, `fromEntries`, `keys`, `values`, `diff`\n\n### 🔢 Number Utilities\n\nFormat, convert, and manipulate numbers.\n\n```typescript\nimport { number } from '@akaoio/util';\n\n// Formatting\nnumber.formatNumber(1234567.89);     // '1,234,567.89'\nnumber.beautifyNumber(1500000);      // '1.5M'\nnumber.percentage(75, 200);          // '37.50%'\n\n// Math operations\nnumber.clamp(15, 0, 10);             // 10\nnumber.round(3.14159, 2);            // 3.14\nnumber.randomInt(1, 10);             // 7 (random)\n\n// Validation & Checks\nnumber.isPrime(17);                  // true\nnumber.isEven(4);                    // true\nnumber.fibonacci(10);                // 55\n```\n\n**Full list:** `clamp`, `round`, `floor`, `ceil`, `formatNumber`, `beautifyNumber`, `percentage`, `isInteger`, `isFloat`, `isEven`, `isOdd`, `isPrime`, `factorial`, `fibonacci`, `gcd`, `lcm`, `toRadians`, `toDegrees`, `lerp`, `normalize`, `randomInt`, `randomFloat`, `average`, `variance`, `standardDeviation`\n\n### 📅 Date Utilities\n\nComprehensive date manipulation and formatting.\n\n```typescript\nimport { date } from '@akaoio/util';\n\n// Formatting\ndate.formatDate(new Date(), 'YYYY-MM-DD');  // '2024-01-20'\ndate.formatDuration(3661000);               // '1h 1m 1s'\n\n// Date arithmetic\ndate.addDays(new Date(), 7);\ndate.addMonths(new Date(), 2);\ndate.diffInDays(date1, date2);\n\n// Comparisons\ndate.isAfter(date1, date2);\ndate.isBefore(date1, date2);\ndate.isSameDay(date1, date2);\n\n// Utilities\ndate.getDaysInMonth(new Date());\ndate.isLeapYear(2024);  // true\n```\n\n**Full list:** `formatDate`, `parseDate`, `addDays`, `addMonths`, `addYears`, `addHours`, `addMinutes`, `addSeconds`, `diffInDays`, `diffInHours`, `diffInMinutes`, `diffInSeconds`, `isAfter`, `isBefore`, `isSameDay`, `isLeapYear`, `getDaysInMonth`, `getWeekday`, `getMonth`, `startOfDay`, `endOfDay`, `startOfMonth`, `endOfMonth`, `startOfYear`, `endOfYear`, `formatDuration`, `toISOString`, `fromUnixTime`, `toUnixTime`\n\n### 🔐 Crypto Utilities\n\nHashing, encoding, and cryptographic functions.\n\n```typescript\nimport { crypto } from '@akaoio/util';\n\n// Hashing\nawait crypto.sha256('hello');        // '2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c...'\nawait crypto.md5('hello');           // '5d41402abc4b2a76b9719d911017c592'\n\n// Encoding\ncrypto.base64Encode('hello');        // 'aGVsbG8='\ncrypto.base64Decode('aGVsbG8=');     // 'hello'\n\n// Generation\nawait crypto.generateUUID();         // 'f47ac10b-58cc-4372-a567-0e02b2c3d479'\nawait crypto.generateRandomHex(16);  // '4f3c2a1b8e9d7c6a5b4e3f2d1c0a9b8e'\n\n// Key derivation\nawait crypto.pbkdf2('password', 'salt', 100000, 32);\n```\n\n**Full list:** `sha256`, `md5`, `base64Encode`, `base64Decode`, `base64UrlEncode`, `base64UrlDecode`, `hexToBase64`, `base64ToHex`, `hexToBytes`, `bytesToHex`, `generateRandomBytes`, `generateRandomHex`, `generateUUID`, `hashCode`, `pbkdf2`\n\n### 🎲 Random Utilities\n\nGenerate random values for testing and simulations.\n\n```typescript\nimport { random } from '@akaoio/util';\n\n// Basic random\nrandom.randomInt(1, 100);            // 42\nrandom.randomFloat(0, 1);            // 0.7264\nrandom.randomBoolean(0.7);           // true (70% chance)\n\n// String generation\nrandom.randomString(10);             // 'Ab3Xk9Qw2P'\nrandom.randomPassword({ length: 16, symbols: true });\nrandom.randomEmail();                // 'user123@example.com'\n\n// Advanced\nrandom.randomColor();                // '#3A7F9C'\nrandom.randomIP();                   // '192.168.1.42'\nrandom.randomMAC();                  // 'a1:b2:c3:d4:e5:f6'\nrandom.randomGaussian(0, 1);        // Normal distribution\n```\n\n**Full list:** `randomInt`, `randomFloat`, `randomBoolean`, `randomChoice`, `randomChoices`, `randomSample`, `randomString`, `randomAlpha`, `randomNumeric`, `randomAlphanumeric`, `randomHex`, `randomPassword`, `randomEmail`, `randomIP`, `randomIPv6`, `randomMAC`, `randomColor`, `randomRGB`, `randomHSL`, `randomDate`, `randomKey`, `shuffle`, `randomWeighted`, `randomGaussian`, `randomExponential`, `randomPoisson`\n\n### 🌐 URL Utilities\n\nParse, build, and manipulate URLs.\n\n```typescript\nimport { url } from '@akaoio/util';\n\n// Parsing\nurl.parseUrl('https://example.com/path?key=value#hash');\n// { protocol: 'https:', host: 'example.com', pathname: '/path', ... }\n\n// Building\nurl.buildUrl('https://api.example.com', '/users', { page: 1, limit: 10 });\n// 'https://api.example.com/users?page=1&limit=10'\n\n// Query parameters\nurl.getQueryParams('https://example.com?a=1&b=2');  // { a: '1', b: '2' }\nurl.addQueryParams(url, { c: 3 });\nurl.removeQueryParams(url, ['a']);\n\n// Utilities\nurl.isValidUrl('https://example.com');  // true\nurl.extractDomain('https://sub.example.com/path');  // 'sub.example.com'\nurl.normalizeUrl('https://example.com//path/');  // 'https://example.com/path'\n```\n\n**Full list:** `parseUrl`, `buildUrl`, `getQueryParams`, `addQueryParams`, `removeQueryParams`, `extractDomain`, `extractPath`, `isAbsoluteUrl`, `isRelativeUrl`, `joinUrl`, `normalizeUrl`, `encodeQueryString`, `decodeQueryString`, `isValidUrl`, `cleanUrl`, `getBaseUrl`, `resolveUrl`, `encodeUrlForFilename`, `isSameOrigin`, `getUrlExtension`, `removeUrlProtocol`, `ensureUrlProtocol`, `extractUrlsFromText`\n\n### ✅ Validation Utilities\n\nComprehensive validation for common data types.\n\n```typescript\nimport { validation } from '@akaoio/util';\n\n// Contact validation\nvalidation.isEmail('user@example.com');     // true\nvalidation.isPhone('+1234567890', 'US');    // true\nvalidation.isPostalCode('12345', 'US');     // true\n\n// Network validation\nvalidation.isIPv4('192.168.1.1');           // true\nvalidation.isIPv6('2001:db8::1');           // true\nvalidation.isMAC('01:23:45:67:89:AB');      // true\n\n// Financial validation\nvalidation.isCreditCard('4111111111111111'); // true (Visa)\nvalidation.isIBAN('DE89370400440532013000'); // true\n\n// Security validation\nvalidation.isStrongPassword('Pass123!@#', {\n  minLength: 8,\n  requireUppercase: true,\n  requireNumbers: true,\n  requireSymbols: true\n});  // true\n\n// Data format validation\nvalidation.isJSON('{\"valid\": true}');       // true\nvalidation.isBase64('SGVsbG8gV29ybGQ=');    // true\nvalidation.isUUID('550e8400-e29b-41d4-a716-446655440000'); // true\n```\n\n**Full list:** `isEmail`, `isUrl`, `isIPv4`, `isIPv6`, `isIP`, `isMAC`, `isUUID`, `isHexColor`, `isRGBColor`, `isHSLColor`, `isAlpha`, `isAlphanumeric`, `isNumeric`, `isDecimal`, `isBase64`, `isJSON`, `isCreditCard`, `isPhone`, `isPostalCode`, `isStrongPassword`, `isDate`, `isISO8601`, `isEmpty`, `isInteger`, `isFloat`, `isPositive`, `isNegative`, `isInRange`, `hasMinLength`, `hasMaxLength`\n\n### 📁 File Utilities (Node.js only)\n\nFile system operations with async/await support.\n\n```typescript\nimport { file } from '@akaoio/util';\n\n// File operations\nawait file.exists('/path/to/file');\nawait file.readJson('/config.json');\nawait file.writeJson('/data.json', data);\n\n// Directory operations\nawait file.ensureDir('/path/to/dir');\nawait file.copy('/source', '/destination');\nawait file.remove('/path/to/delete');\n\n// Path utilities\nfile.join('/path', 'to', 'file.txt');\nfile.getExtension('/file.txt');  // '.txt'\nfile.formatBytes(1024);           // '1 KB'\n\n// Search\nawait file.find('/dir', (path, stats) => stats.isFile());\n```\n\n**Full list:** `exists`, `existsSync`, `ensureDir`, `ensureDirSync`, `readJson`, `readJsonSync`, `writeJson`, `writeJsonSync`, `readText`, `readTextSync`, `writeText`, `writeTextSync`, `appendText`, `appendTextSync`, `copy`, `copySync`, `remove`, `removeSync`, `move`, `moveSync`, `getSize`, `getSizeSync`, `formatBytes`, `getExtension`, `getBasename`, `getDirname`, `join`, `resolve`, `normalize`, `isAbsolute`, `relative`, `find`, `findSync`\n\n## 🎯 Real-World Examples\n\n### Building a URL with query parameters\n\n```typescript\nimport { buildUrl, encodeQueryString } from '@akaoio/util/url';\n\nconst apiUrl = buildUrl(\n  'https://api.example.com',\n  '/search',\n  {\n    q: 'typescript utils',\n    page: 1,\n    limit: 20,\n    filters: ['popular', 'recent']\n  }\n);\n// https://api.example.com/search?q=typescript%20utils&page=1&limit=20&filters=popular&filters=recent\n```\n\n### Processing user input\n\n```typescript\nimport { string, validation } from '@akaoio/util';\n\nfunction processUserInput(input: string) {\n  const trimmed = input.trim();\n  \n  if (validation.isEmail(trimmed)) {\n    return {\n      type: 'email',\n      value: trimmed.toLowerCase(),\n      domain: trimmed.split('@')[1]\n    };\n  }\n  \n  if (validation.isUrl(trimmed)) {\n    return {\n      type: 'url',\n      value: string.normalizeUrl(trimmed),\n      domain: url.extractDomain(trimmed)\n    };\n  }\n  \n  return {\n    type: 'text',\n    value: string.truncate(trimmed, 100),\n    slug: string.slugify(trimmed)\n  };\n}\n```\n\n### Data transformation pipeline\n\n```typescript\nimport { array, object, number } from '@akaoio/util';\n\nconst users = [\n  { id: 1, name: 'Alice', age: 30, score: 85 },\n  { id: 2, name: 'Bob', age: 25, score: 92 },\n  { id: 3, name: 'Charlie', age: 35, score: 78 }\n];\n\nconst result = users\n  .filter(u => u.age >= 25)\n  .map(u => object.pick(u, ['name', 'score']))\n  .sort((a, b) => b.score - a.score);\n\nconst stats = {\n  average: number.average(users.map(u => u.score)),\n  median: number.median(users.map(u => u.score)),\n  stdDev: number.standardDeviation(users.map(u => u.score))\n};\n```\n\n## 🌍 Browser Support\n\nMost utilities work in all modern browsers. Node.js specific features (like file operations) are only available in Node.js environments.\n\n| Module | Node.js | Browser | Deno |\n|--------|---------|---------|------|\n| String | ✅ | ✅ | ✅ |\n| Array | ✅ | ✅ | ✅ |\n| Object | ✅ | ✅ | ✅ |\n| Number | ✅ | ✅ | ✅ |\n| Date | ✅ | ✅ | ✅ |\n| Crypto | ✅ | ✅* | ✅ |\n| Random | ✅ | ✅ | ✅ |\n| URL | ✅ | ✅ | ✅ |\n| Validation | ✅ | ✅ | ✅ |\n| File | ✅ | ❌ | ✅ |\n\n*Some crypto functions require Web Crypto API support\n\n## 📦 Bundle Size\n\nThe library is designed to be tree-shakeable. Here are approximate sizes when importing specific modules:\n\n| Import | Size (minified + gzipped) |\n|--------|---------------------------|\n| String utils only | ~2.5 KB |\n| Array utils only | ~3.2 KB |\n| Object utils only | ~2.8 KB |\n| Number utils only | ~2.1 KB |\n| Full library | ~35 KB |\n\n## 🧪 Testing\n\n```bash\n# Run tests\nnpm test\n\n# Run tests with coverage\nnpm run test:coverage\n\n# Run tests in watch mode\nnpm run test:watch\n```\n\n## 🔧 Development\n\n```bash\n# Clone the repository\ngit clone https://github.com/akaoio/util.git\ncd util\n\n# Install dependencies\nnpm install\n\n# Build the library\nnpm run build\n\n# Run tests\nnpm test\n\n# Lint code\nnpm run lint\n\n# Format code\nnpm run format\n```\n\n## 📄 License\n\nMIT © [akaoio](https://github.com/akaoio)\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 💖 Support\n\nIf you find this package useful, please consider:\n\n- ⭐ Starring the [GitHub repository](https://github.com/akaoio/util)\n- 🐛 Reporting bugs and suggesting features in [GitHub Issues](https://github.com/akaoio/util/issues)\n- 📖 Improving documentation\n- 💻 Contributing code improvements\n\n## 📮 Contact\n\n- GitHub: [@akaoio](https://github.com/akaoio)\n- Email: dev@akao.io\n\n---\n\n<p align=\"center\">Made with ❤️ by <a href=\"https://github.com/akaoio\">akaoio</a></p>","readmeFilename":"README.md"}