{"_id":"gravi","_rev":"2-9ddefddd4ba380c79545392785067580","name":"gravi","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"gravi","version":"1.0.0","keywords":[],"author":{"name":"Theo Gravity","email":"theo@suteki.nu"},"license":"MIT","_id":"gravi@1.0.0","maintainers":[{"name":"theo.gravity","email":"theo@suteki.nu"}],"homepage":"https://github.com/theogravity/grav","bugs":{"url":"https://github.com/theogravity/grav/issues"},"dist":{"shasum":"452bb4a84f0ed68840c094837d4c04406991d165","tarball":"https://registry.npmjs.org/gravi/-/gravi-1.0.0.tgz","fileCount":3,"integrity":"sha512-JEP4JNgdb7QAP0AQCiPm+UJUyz3DpYRZkhETDsgfqltJwoojHWS7olphKG7AcRh/Zt9EZLw7WvCC7Fg9voITbg==","signatures":[{"sig":"MEUCIQDlhGj0AnQcMvpvrGBpDh0EvvF0eBX+sha8BNjE9UrpSgIgQftVtOrVDaNeXwo6bIHzdBBPHzwnP749AxLBr/kaj48=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6974},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"cd1f98d5229f7ba5df09cec52b24bef90b9172e7","scripts":{"lint":"biome check --write --unsafe src && biome format src --write && biome lint src --fix","test":"vitest run","build":"tsup src/index.ts","clean":"rm -rf node_modules dist","debug":"ts-node-dev --inspect -- src/index.ts","prepare":"husky","release":"changeset publish","changeset":"changeset","typecheck":"tsc --noEmit","test:watch":"vitest","debug:break":"ts-node-dev --inspect-brk -- src/index.ts","lint-staged":"lint-staged","syncpack:fix":"syncpack fix-mismatches","add-changeset":"changeset add","syncpack:lint":"syncpack lint","syncpack:format":"syncpack format","syncpack:update":"syncpack update","version-packages":"changeset version"},"_npmUser":{"name":"theo.gravity","email":"theo@suteki.nu"},"repository":{"url":"git+ssh://git@github.com/theogravity/grav.git","type":"git"},"_npmVersion":"10.8.2","description":"Generates Gravatar URLs using sha256 hashes with support for various options.","directories":{},"lint-staged":{"**/package.json":["pnpm run syncpack:format","pnpm run syncpack:lint"],"**/*.{js,jsx,ts,tsx,html,css,json}":["pnpm run lint"]},"_nodeVersion":"22.6.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@9.6.0","devDependencies":{"tsup":"8.2.4","husky":"9.1.5","turbo":"2.1.1","vitest":"2.0.5","syncpack":"13.0.0","typescript":"5.5.4","@types/node":"22.5.3","lint-staged":"15.2.10","@biomejs/biome":"1.8.3","@changesets/cli":"2.27.8","@commitlint/cli":"19.4.1","@changesets/changelog-github":"0.5.0","@commitlint/config-conventional":"19.4.1"},"_npmOperationalInternal":{"tmp":"tmp/gravi_1.0.0_1725484606287_0.941238926198025","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"gravi","version":"1.0.1","keywords":["gravatar","sha256","generator","url","avatar","image","profile","typescript"],"author":{"name":"Theo Gravity","email":"theo@suteki.nu"},"license":"MIT","_id":"gravi@1.0.1","maintainers":[{"name":"theo.gravity","email":"theo@suteki.nu"}],"homepage":"https://github.com/theogravity/gravi","bugs":{"url":"https://github.com/theogravity/gravi/issues"},"dist":{"shasum":"6b9b547a36c8d35f28251876bb4c249e9fea4730","tarball":"https://registry.npmjs.org/gravi/-/gravi-1.0.1.tgz","fileCount":9,"integrity":"sha512-jM5ItmCoenz1WRUK/nQLPGJ26VglXfFao/YVxHa5HzSRdEyG3P6NkHvRIASWtI9vKJC63/gwZosYh3HnespvWA==","signatures":[{"sig":"MEYCIQCIkBmRQQiYxJZ9K11YDs99V37pgx0XEsK79CbzYEoBfAIhALdto2ckD2wreAbEcJfToW37pv4IyIvuGmdPjqXe2xrz","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":22361},"main":"dist/index.js","_from":"file:gravi-1.0.1.tgz","types":"dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"lint":"biome check --write --unsafe src && biome format src --write && biome lint src --fix","test":"vitest run","build":"tsup src/index.ts","clean":"rm -rf node_modules dist","debug":"ts-node-dev --inspect -- src/index.ts","release":"changeset publish","changeset":"changeset","typecheck":"tsc --noEmit","test:watch":"vitest","debug:break":"ts-node-dev --inspect-brk -- src/index.ts","lint-staged":"lint-staged","syncpack:fix":"syncpack fix-mismatches","add-changeset":"changeset add","syncpack:lint":"syncpack lint","syncpack:format":"syncpack format","syncpack:update":"syncpack update","version-packages":"changeset version"},"_npmUser":{"name":"theo.gravity","email":"theo@suteki.nu"},"_resolved":"/tmp/55b236cf4132050835762302523b6358/gravi-1.0.1.tgz","_integrity":"sha512-jM5ItmCoenz1WRUK/nQLPGJ26VglXfFao/YVxHa5HzSRdEyG3P6NkHvRIASWtI9vKJC63/gwZosYh3HnespvWA==","repository":{"url":"git+ssh://git@github.com/theogravity/gravi.git","type":"git"},"_npmVersion":"10.7.0","description":"Generates Gravatar URLs using sha256 hashes with support for various options.","directories":{},"lint-staged":{"**/package.json":["pnpm run syncpack:format","pnpm run syncpack:lint"],"**/*.{js,jsx,ts,tsx,html,css,json}":["pnpm run lint"]},"_nodeVersion":"18.20.4","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"8.2.4","husky":"9.1.5","turbo":"2.1.1","vitest":"2.0.5","syncpack":"13.0.0","typescript":"5.5.4","@types/node":"22.5.3","lint-staged":"15.2.10","@biomejs/biome":"1.8.3","@changesets/cli":"2.27.8","@commitlint/cli":"19.4.1","@changesets/changelog-github":"0.5.0","@commitlint/config-conventional":"19.4.1"},"_npmOperationalInternal":{"tmp":"tmp/gravi_1.0.1_1725485260850_0.9125161564831608","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"gravi","description":"Generates Gravatar URLs using sha256 hashes with support for various options.","version":"1.0.2","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"author":{"name":"Theo Gravity","email":"theo@suteki.nu"},"keywords":["gravatar","sha256","generator","url","avatar","image","profile","typescript"],"devDependencies":{"@biomejs/biome":"1.8.3","@changesets/changelog-github":"0.5.0","@changesets/cli":"2.27.8","@commitlint/cli":"19.4.1","@commitlint/config-conventional":"19.4.1","@types/node":"22.5.3","husky":"9.1.5","lint-staged":"15.2.10","tsup":"8.2.4","syncpack":"13.0.0","turbo":"2.1.1","typescript":"5.5.4","vitest":"2.0.5"},"bugs":{"url":"https://github.com/theogravity/gravi/issues"},"engines":{"node":">=18"},"homepage":"https://github.com/theogravity/gravi","license":"MIT","lint-staged":{"**/*.{js,jsx,ts,tsx,html,css,json}":["pnpm run lint"],"**/package.json":["pnpm run syncpack:format","pnpm run syncpack:lint"]},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+ssh://git@github.com/theogravity/gravi.git"},"scripts":{"build":"tsup src/index.ts","changeset":"changeset","add-changeset":"changeset add","clean":"rm -rf node_modules dist","debug":"ts-node-dev --inspect -- src/index.ts","debug:break":"ts-node-dev --inspect-brk -- src/index.ts","lint":"biome check --write --unsafe src && biome format src --write && biome lint src --fix","lint-staged":"lint-staged","release":"changeset publish","syncpack:update":"syncpack update","syncpack:fix":"syncpack fix-mismatches","syncpack:format":"syncpack format","syncpack:lint":"syncpack lint","test":"vitest run","test:watch":"vitest","typecheck":"tsc --noEmit","version-packages":"changeset version"},"_id":"gravi@1.0.2","_integrity":"sha512-IAGnPr9xfDjAVr9qPlfWhrBUjLIjw8Tlo3aO9Qv9qrOaMlMgdqhf5myl5zxmRSmnXfV6k93M4tBdCOVkyB1S6w==","_resolved":"/tmp/3c371cef6b09363119a56571f711281a/gravi-1.0.2.tgz","_from":"file:gravi-1.0.2.tgz","_nodeVersion":"18.20.4","_npmVersion":"10.7.0","dist":{"integrity":"sha512-IAGnPr9xfDjAVr9qPlfWhrBUjLIjw8Tlo3aO9Qv9qrOaMlMgdqhf5myl5zxmRSmnXfV6k93M4tBdCOVkyB1S6w==","shasum":"6995b3eec40d620d7fa869590699348eaad99613","tarball":"https://registry.npmjs.org/gravi/-/gravi-1.0.2.tgz","fileCount":9,"unpackedSize":22462,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCL9UvPpQJnniWv3WrwVO9+ZyMTulono5ABLchsLUbMPgIgHRxxxlwdJ/m6L3SPuDwBz8UrYgiiEdVGwUMWyxLwWRw="}]},"_npmUser":{"name":"theo.gravity","email":"theo@suteki.nu"},"directories":{},"maintainers":[{"name":"theo.gravity","email":"theo@suteki.nu"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/gravi_1.0.2_1725557034225_0.40217717521632657"},"_hasShrinkwrap":false}},"time":{"created":"2024-09-04T21:16:46.170Z","modified":"2024-09-05T17:23:54.579Z","1.0.0":"2024-09-04T21:16:46.429Z","1.0.1":"2024-09-04T21:27:41.036Z","1.0.2":"2024-09-05T17:23:54.402Z"},"bugs":{"url":"https://github.com/theogravity/gravi/issues"},"author":{"name":"Theo Gravity","email":"theo@suteki.nu"},"license":"MIT","homepage":"https://github.com/theogravity/gravi","keywords":["gravatar","sha256","generator","url","avatar","image","profile","typescript"],"repository":{"type":"git","url":"git+ssh://git@github.com/theogravity/gravi.git"},"description":"Generates Gravatar URLs using sha256 hashes with support for various options.","maintainers":[{"name":"theo.gravity","email":"theo@suteki.nu"}],"readme":"# gravi: Gravatar URL Generator\n\n[![NPM version](https://img.shields.io/npm/v/gravi.svg?style=flat-square)](https://www.npmjs.com/package/gravi)\n![NPM Downloads](https://img.shields.io/npm/dm/gravi)\n[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)\n\n`gravi` generates Gravatar URLs using sha256 hashes with support for various options. \n\nIt has no dependencies and works in node.js and the browser.\n\n## Installation\n\n```bash\nnpm install gravi\n```\n\n## Usage\n\n### Generating a Basic Gravatar URL\n\nFor a basic Gravatar URL, you only need to provide an email address.\n\n```typescript\nimport { generateGravatarUrl } from 'gravi';\n\nconst email = 'user@example.com';\n\nconst url = await generateGravatarUrl(email);\nconsole.log(url); // Default URL: https://www.gravatar.com/avatar/b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514\n```\n\n### Adding Options\n\nYou can customize the Gravatar URL with various options like size, default image, rating, forced default image, file extension, protocol, and base URL.\n\n```typescript\nimport { generateGravatarUrl, GenerateGravatarUrlOptions } from 'gravi';\n\nconst email = 'user@example.com';\n\nconst options: GenerateGravatarUrlOptions = {\n  size: 200,\n  default: 'identicon',\n  rating: 'pg',\n  forcedefault: 'y',\n  extension: 'jpg',\n  protocol: 'http',\n  baseUrl: 'http://custom.gravatar.com/avatar/',\n};\n\nconst url = await generateGravatarUrl(email, options);\nconsole.log(url); // Custom URL: http://custom.gravatar.com/avatar/b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514.jpg?s=200&d=identicon&r=pg&f=y\n```\n\n### Handling Null or Undefined Emails\n\nIf the email is `null`, `undefined`, or not a string, the function will use a default hash.\n\n```typescript\nimport { generateGravatarUrl } from 'gravi';\n\nconst undefinedEmail = undefined;\n\nconst url = await generateGravatarUrl(undefinedEmail);\nconsole.log(url); // Default hash URL: https://www.gravatar.com/avatar/000000000000000000000000000000000000000000000000000000\n```\n\n### Using with Multiple Options\n\nYou can combine various options to create highly customized Gravatar URLs.\n\n```typescript\nimport { generateGravatarUrl, GenerateGravatarUrlOptions } from 'gravi';\n\nconst email = 'user@example.com';\n\nconst options: GenerateGravatarUrlOptions = {\n  size: 150,\n  default: 'retro',\n  rating: 'g',\n  forcedefault: 'n',\n  extension: 'png',\n  protocol: 'https',\n  baseUrl: 'https://secure.gravatar.com/avatar/',\n};\n\nconst url = await generateGravatarUrl(email, options);\nconsole.log(url); // Custom URL: https://secure.gravatar.com/avatar/b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514.png?s=150&d=retro&r=g&f=n\n```\n\n## API\n\n### `generateGravatarUrl(email: string, options: GenerateGravatarUrlOptions = {})`\n\n#### Parameters\n\n- `email` (string | null | undefined): The email address for which to generate the Gravatar URL.\n- `options` (`GenerateGravatarUrlOptions`): An optional object containing Gravatar options.\n\n#### `GenerateGravatarUrlOptions`\n\n- `size` (number): The size of the Gravatar image.\n- `default` (string): URL or one of the built-in defaults (`404`, `mp`, `identicon`, `monsterid`, `wavatar`, `retro`, `robohash`, `blank`).\n- `rating` ('g' | 'pg' | 'r' | 'x'): The rating of the Gravatar image.\n- `forcedefault` ('y' | 'n'): Force the default Gravatar image to always be used.\n- `extension` ('jpg' | 'png' | 'gif'): File extension for the Gravatar image.\n- `protocol` ('http' | 'https'): The protocol to use. Default is `https`.\n- `baseUrl` (string): The base URL for the Gravatar service. Default is `<protocol>://www.gravatar.com/avatar/`.\n\n#### Returns\n\nA `Promise<string>` that resolves to the generated Gravatar URL. If the email is `null`, `undefined`, or not a string, \na default hash is used.\n","readmeFilename":"README.md"}