{"_id":"@bradleyhodges/swiss","name":"@bradleyhodges/swiss","dist-tags":{"latest":"5.1.3"},"versions":{"5.1.3":{"name":"@bradleyhodges/swiss","description":"Powerful utility functions for Next.js, Vercel, and React - your Swiss Army Knife for Next development.","version":"5.1.3","main":"dist/main/index.js","module":"dist/module/index.js","exports":{".":{"import":"./dist/module/index.js","require":"./dist/main/index.js"},"./array":{"import":"./dist/module/array.js","require":"./dist/main/array.js"},"./dayjs":{"import":"./dist/module/dayjs.js","require":"./dist/main/dayjs.js"},"./hibp":{"import":"./dist/module/hibp.js","require":"./dist/main/hibp.js"},"./number":{"import":"./dist/module/number.js","require":"./dist/main/number.js"},"./string":{"import":"./dist/module/string.js","require":"./dist/main/string.js"},"./tailwind":{"import":"./dist/module/tailwind.js","require":"./dist/main/tailwind.js"},"./passwords":{"import":"./dist/module/passwords.js","require":"./dist/main/passwords.js"},"./colors":{"import":"./dist/module/colors.js","require":"./dist/main/colors.js"}},"scripts":{"build":"rm -rf ./dist && tsc && tsc -p tsconfig.main.json","pub":"npm publish --access public --no-git-checks","bump-deps":"npx npm-check-updates --deep -u && pnpm up --latest --recursive && pnpm run format","format":"biome check . --write --skip-errors","clean":"git clean -xdf .cache .turbo node_modules -f","typecheck":"tsc --noEmit --emitDeclarationOnly false"},"repository":{"type":"git","url":"git+https://github.com/bradleyhodges/swiss.git"},"bugs":{"url":"https://github.com/bradleyhodges/swiss/issues"},"author":{"name":"Bradley Hodges"},"dependencies":{"@types/node":"^24.5.2","@types/react":"^19.1.13","clsx":"^2.1.1","dayjs":"^1.11.18","dts-bundle-generator":"^9.5.1","server-only":"^0.0.1","sha1":"^1.1.1","swr":"^2.3.6","tailwind-merge":"^3.3.1","ts-node":"^10.9.2","tslib":"^2.8.1","typescript":"^5.9.2"},"_id":"@bradleyhodges/swiss@5.1.3","gitHead":"f5691e918e4880ab8ed4113ff0519dc74e0682c1","types":"./dist/main/index.d.ts","homepage":"https://github.com/bradleyhodges/swiss#readme","_nodeVersion":"22.15.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-ao2awD/TN955VvSzgETDUB91wtVWw5rgIh5eeKU738d30kaPXLCxcItSvCUbjR97rHbJ/UT1EIv8G4wEXcgPIQ==","shasum":"9e8212ea149e19d9870e094e7845fd5a9416963a","tarball":"https://registry.npmjs.org/@bradleyhodges/swiss/-/swiss-5.1.3.tgz","fileCount":192,"unpackedSize":149468,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDX3nTn/9LR4NuVME58A2Eu8NAg9lecDS5Sp9JRSTqUZwIgQtWrMTt0xRrGZfAsVHEHk2yTN67ZkDLzPLDCGVwy9X0="}]},"_npmUser":{"name":"bradleyhodges","email":"bradley.hodges@outlook.com"},"directories":{},"maintainers":[{"name":"bradleyhodges","email":"bradley.hodges@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/swiss_5.1.3_1758590289888_0.7157667276673829"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-23T01:18:09.802Z","5.1.3":"2025-09-23T01:18:10.076Z","modified":"2025-09-23T01:18:10.351Z"},"maintainers":[{"name":"bradleyhodges","email":"bradley.hodges@outlook.com"}],"description":"Powerful utility functions for Next.js, Vercel, and React - your Swiss Army Knife for Next development.","homepage":"https://github.com/bradleyhodges/swiss#readme","repository":{"type":"git","url":"git+https://github.com/bradleyhodges/swiss.git"},"author":{"name":"Bradley Hodges"},"bugs":{"url":"https://github.com/bradleyhodges/swiss/issues"},"readme":"# TailwindCSS Utilities\r\nThis package provides a set of utilities for working with TailwindCSS.\r\n\r\n## `cn` (Class Names)\r\nThis utility function is used to concatenate class names together. The utility will clean up the class names, order them per TailwindCSS guidelines, and automatically resolve conflicting classes. It can accept an array of class names or a string of class names, and will resolve them accordingly without fuss.\r\n```typescript\r\nimport { cn } from '@advena/swiss/tailwind';\r\n\r\nreturn (\r\n    <div className={cn('text-center text-blue-500 text-center text-red-500')}>\r\n        Hello World\r\n    </div>\r\n);\r\n\r\n// Output: <div className=\"text-red-500 text-center\">Hello World</div>\r\n\r\nreturn (\r\n    <div className={cn('text-center text-blue-500 text-center text-red-500', 'text-left font-bold')}>\r\n        Hello World\r\n    </div>\r\n);\r\n\r\n// Output: <div className=\"font-bold text-red-500 text-center\">Hello World</div>\r\n```\r\n\r\n## `hexToRgb`\r\nThis utility function is used to convert a hex color to an RGB color. It can accept a hex color string with or without the `#` symbol.\r\n```typescript\r\nimport { hexToRgb } from '@advena/swiss/tailwind';\r\n\r\nhexToRgb('#ff0000'); // { r: 255, g: 0, b: 0 }\r\n```\r\n\r\n# String Utilities\r\nThis package provides a set of utilities for working with strings.\r\n\r\n## Capitalize\r\nCapitalizes all characters in a string.\r\n```typescript\r\nimport { capitalize } from '@advena/swiss/string';\r\n\r\ncapitalize('hello world'); // HELLO WORLD\r\n```\r\n\r\n## Lowercase\r\nConverts all characters in a string to lowercase.\r\n```typescript\r\nimport { lowercase } from '@advena/swiss/string';\r\n\r\nlowercase('HELLO WORLD'); // hello world\r\n```\r\n\r\n## Proper Case\r\nConverts the first character of each word in a string to uppercase.\r\n```typescript\r\nimport { properCase } from '@advena/swiss/string';\r\n\r\nproperCase('hello world'); // Hello World\r\n```\r\n\r\n## Capitalize First\r\nConverts the first character of a string to uppercase.\r\n```typescript\r\nimport { capitalizeFirst } from '@advena/swiss/string';\r\n\r\ncapitalizeFirst('hello world'); // Hello world\r\n```\r\n\r\n# DateTime Utilities\r\nThis package provides a set of utilities for working with dates and times.\r\n\r\n## `dayjs`\r\nThis utility is a wrapper around the `dayjs` library. It provides a set of functions for working with dates and times. \r\n\r\nThe `dayjs` export initializes and configures a dayjs instance with automatic localization and timezone support. Extensive documentation is available on the [dayjs website](https://day.js.org/docs/en/installation/installation).\r\n```typescript\r\nimport { dayjs } from '@advena/swiss/datetime';\r\n\r\ndayjs().format('YYYY-MM-DD'); // 2022-01-01\r\n```\r\n\r\n# HIBP (Have I Been Pwned) Utilities\r\nThis package provides a set of utilities for working with the [Have I Been Pwned](https://haveibeenpwned.com/) API.\r\n\r\n## `checkPassword`\r\nThis utility securely checks if a password has been compromised in a data breach. It uses the [Have I Been Pwned API](https://haveibeenpwned.com/api/v3) to check the password against a database of known breaches.\r\n\r\n> [!IMPORTANT]\r\n> This utility uses swr. It can only be imported on the client - it will not work with Next.js SSR/SSG and will generate errors.\r\n\r\n```typescript\r\nimport { checkPassword } from '@advena/swiss/hibp';\r\n\r\ncheckPassword('password123').then((result) => {\r\n    console.log(result); // { count: 123456, isCompromised: true }\r\n});\r\n```\r\n\r\n> [!NOTE]\r\n> This utility does not send the password to the API. Instead, it sends the first 5 characters of a SHA-1 hash of the password (k-anonymity) to the API. The API then returns a list of hashes that match the prefix, and the client checks if the full hash is in the list. No portion of the plaintext password ever leaves the client.","readmeFilename":"README.md","_rev":"1-29a293ac60ea7347774f46848e59a5a7"}