{"_id":"@amiearth/mask-email","_rev":"4-9ac71236b9f06fb671d5daed2d675635","name":"@amiearth/mask-email","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.0":{"name":"@amiearth/mask-email","version":"1.0.0","keywords":[],"author":"","license":"ISC","_id":"@amiearth/mask-email@1.0.0","maintainers":[{"name":"amiearth","email":"sutthiphongnuanma@gmail.com"}],"dist":{"shasum":"7d201d4c7888061fdb57586105f20e8f7df22274","tarball":"https://registry.npmjs.org/@amiearth/mask-email/-/mask-email-1.0.0.tgz","fileCount":5,"integrity":"sha512-hNvQxKvq5+DzpLcKR4qkBf9Aqj2oK0Tx32oujZMwzIPQ93l/1jdbx7gPqlVf1ekZNMoHb/iMxFeoAFnyUUvVPg==","signatures":[{"sig":"MEUCIQDf33/5j0N4Twg2gBI2/sPSo58QaT2V6q7tqsY2Ze3efQIgPFA2aL+QbvEAIWfE++RyOw36HtiXI3soNFu59No9VNE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":3105},"main":"index.js","type":"module","scripts":{"test":"vitest","build":"tsup src/index.ts --format cjs,esm --dts","prepublishOnly":"npm run build"},"_npmUser":{"name":"amiearth","email":"sutthiphongnuanma@gmail.com"},"_npmVersion":"11.3.0","description":"","directories":{},"_nodeVersion":"23.7.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vitest":"^3.2.4","typescript":"^5.9.3","@types/node":"^24.10.1"},"_npmOperationalInternal":{"tmp":"tmp/mask-email_1.0.0_1764779221103_0.7444468272196854","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@amiearth/mask-email","version":"1.0.1","keywords":["email","mask","privacy","security","typescript","hide","obfuscate","protect"],"author":"","license":"ISC","_id":"@amiearth/mask-email@1.0.1","maintainers":[{"name":"amiearth","email":"sutthiphongnuanma@gmail.com"}],"dist":{"shasum":"40172aab90cb9f8896e0e0a3d511968f7bf7cf81","tarball":"https://registry.npmjs.org/@amiearth/mask-email/-/mask-email-1.0.1.tgz","fileCount":6,"integrity":"sha512-D2MEVAn83nulS3rJN0lmOhFQnnbVCSRSkN0dGmZHWUEjM1IOhVjC74Le+xnOrxPJu8aaXgAPrs9VUXL0OqSJLw==","signatures":[{"sig":"MEYCIQDeQ5KVsdbfO05+IjWfSwuf8LjMuHjEYHJNZUuZPFxlqgIhAKmVI++6VwolGne6KY6nXLg+QmZX6P702GpT68qk0MHb","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":6036},"main":"index.js","type":"module","scripts":{"test":"vitest","build":"tsup src/index.ts --format cjs,esm --dts","prepublishOnly":"npm run build"},"_npmUser":{"name":"amiearth","email":"sutthiphongnuanma@gmail.com"},"_npmVersion":"11.3.0","description":"A lightweight TypeScript library for masking email addresses to protect user privacy","directories":{},"_nodeVersion":"23.7.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vitest":"^3.2.4","typescript":"^5.9.3","@types/node":"^24.10.1"},"_npmOperationalInternal":{"tmp":"tmp/mask-email_1.0.1_1764779348931_0.01190391420493686","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@amiearth/mask-email","version":"1.0.2","keywords":["email","mask","privacy","security","typescript","hide","obfuscate","protect"],"author":"","license":"ISC","_id":"@amiearth/mask-email@1.0.2","maintainers":[{"name":"amiearth","email":"sutthiphongnuanma@gmail.com"}],"homepage":"https://github.com/earth774/mask-email#readme","bugs":{"url":"https://github.com/earth774/mask-email/issues"},"dist":{"shasum":"7b3066b0a6ce25051c8e95359878599b7c1793d4","tarball":"https://registry.npmjs.org/@amiearth/mask-email/-/mask-email-1.0.2.tgz","fileCount":19,"integrity":"sha512-DRKPvJ7hB82TQtxDkig0p/sFIsWTKz9WzmdrKzqpE1ev7X2SSu5CjX4PkRmchZoWH2l+wstHuTIwJsONHMKpfQ==","signatures":[{"sig":"MEYCIQCPyVa0ppN5MsEFHdIvR1PdQXi175l9BS+Kf2oNt7h0AAIhAKbIkGNpt4nMh/cSzbAcsOTjXc8uSswE2zwSThPOn62F","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":58930},"main":"index.js","type":"module","gitHead":"28d079f9c3f9a09ee20592af27029ca7212d08dd","scripts":{"test":"vitest","build":"tsup src/index.ts --format cjs,esm --dts","publish:major":"npm version major && npm publish --access public","publish:minor":"npm version minor && npm publish --access public","publish:patch":"npm version patch && npm publish --access public","test:coverage":"vitest run --coverage","prepublishOnly":"npm run build"},"_npmUser":{"name":"amiearth","email":"sutthiphongnuanma@gmail.com"},"repository":{"url":"git+https://github.com/earth774/mask-email.git","type":"git"},"_npmVersion":"11.3.0","description":"A lightweight TypeScript library for masking email addresses to protect user privacy","directories":{},"_nodeVersion":"23.7.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vitest":"^3.2.4","typescript":"^5.9.3","@types/node":"^24.10.1","@vitest/coverage-v8":"^3.2.4"},"_npmOperationalInternal":{"tmp":"tmp/mask-email_1.0.2_1764780650455_0.6429818865668697","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@amiearth/mask-email","version":"1.0.3","description":"A lightweight TypeScript library for masking email addresses to protect user privacy","main":"index.js","scripts":{"build":"tsup src/index.ts --format cjs,esm --dts","test":"vitest","test:coverage":"vitest run --coverage","prepublishOnly":"npm run build","publish:patch":"npm version patch && npm publish --access public","publish:minor":"npm version minor && npm publish --access public","publish:major":"npm version major && npm publish --access public"},"keywords":["email","mask","privacy","security","typescript","hide","obfuscate","protect"],"author":"","license":"ISC","repository":{"type":"git","url":"git+https://github.com/earth774/mask-email.git"},"bugs":{"url":"https://github.com/earth774/mask-email/issues"},"homepage":"https://github.com/earth774/mask-email#readme","type":"module","devDependencies":{"@types/node":"^24.10.1","@vitest/coverage-v8":"^3.2.4","tsup":"^8.5.1","typescript":"^5.9.3","vitest":"^3.2.4"},"_id":"@amiearth/mask-email@1.0.3","gitHead":"9c9775e950b80e1a274938871eeb932be7fb478f","_nodeVersion":"23.7.0","_npmVersion":"11.3.0","dist":{"integrity":"sha512-Ve8gB6eHq6Y6NGAI58B4pGfP8Zkc5gM3hW1ViYu2c2TpVV9RcTaDAtUV1/qfVurOogCtk+hxQ/atxbMaUXjIww==","shasum":"f84ed7c210096d53c76c43ce4681d31cafcbbfc1","tarball":"https://registry.npmjs.org/@amiearth/mask-email/-/mask-email-1.0.3.tgz","fileCount":6,"unpackedSize":6657,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDD7buFv/LP5W4lRRmrVIbZGY8fVlKyeb+xpJHW5Up7MAiEAgUdqExbskH3u1u4MPBFwC5AjkUinP44KOg2W7ogHVMQ="}]},"_npmUser":{"name":"amiearth","email":"sutthiphongnuanma@gmail.com"},"directories":{},"maintainers":[{"name":"amiearth","email":"sutthiphongnuanma@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mask-email_1.0.3_1764781982356_0.6451581247567295"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-03T16:27:00.979Z","modified":"2025-12-03T17:13:02.736Z","1.0.0":"2025-12-03T16:27:01.287Z","1.0.1":"2025-12-03T16:29:09.097Z","1.0.2":"2025-12-03T16:50:50.640Z","1.0.3":"2025-12-03T17:13:02.548Z"},"bugs":{"url":"https://github.com/earth774/mask-email/issues"},"license":"ISC","homepage":"https://github.com/earth774/mask-email#readme","keywords":["email","mask","privacy","security","typescript","hide","obfuscate","protect"],"repository":{"type":"git","url":"git+https://github.com/earth774/mask-email.git"},"description":"A lightweight TypeScript library for masking email addresses to protect user privacy","maintainers":[{"name":"amiearth","email":"sutthiphongnuanma@gmail.com"}],"readme":"# @amiearth/mask-email\n\nA lightweight, zero-dependency TypeScript library for masking email addresses to protect user privacy. Perfect for displaying emails in logs, UI components, or any scenario where you need to hide sensitive information.\n\n## Features\n\n- 🎯 **Simple API** - Easy to use with minimal configuration\n- 🔒 **Privacy-focused** - Protect user email addresses from exposure\n- 📦 **Zero dependencies** - Lightweight and fast\n- 🎨 **Customizable** - Configure mask character and visible characters\n- 📝 **TypeScript** - Full TypeScript support with type definitions\n- ✅ **Well tested** - Comprehensive test coverage\n\n## Installation\n\n```bash\nnpm install @amiearth/mask-email\n```\n\n```bash\nyarn add @amiearth/mask-email\n```\n\n```bash\npnpm add @amiearth/mask-email\n```\n\n## Usage\n\n### Basic Usage\n\n```typescript\nimport { maskEmail } from '@amiearth/mask-email';\n\n// Default masking (shows first 2 characters)\nmaskEmail('johndoe@gmail.com');\n// Returns: 'jo*******@gmail.com'\n```\n\n### Custom Options\n\n```typescript\nimport { maskEmail } from '@amiearth/mask-email';\n\n// Custom mask character\nmaskEmail('johndoe@gmail.com', { maskChar: '#' });\n// Returns: 'jo#######@gmail.com'\n\n// Show more characters\nmaskEmail('johndoe@gmail.com', { visibleStart: 3 });\n// Returns: 'joh******@gmail.com'\n\n// Combine options\nmaskEmail('johndoe@gmail.com', { maskChar: '•', visibleStart: 4 });\n// Returns: 'john•••••@gmail.com'\n```\n\n## API\n\n### `maskEmail(email: string, options?: MaskOptions): string`\n\nMasks an email address by hiding part of the local part (before @) while keeping the domain visible.\n\n#### Parameters\n\n- `email` (string, required) - The email address to mask\n- `options` (MaskOptions, optional) - Configuration options\n\n#### Options\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `maskChar` | `string` | `'*'` | Character used for masking |\n| `visibleStart` | `number` | `2` | Number of characters to show at the start of the local part |\n\n#### Returns\n\n- `string` - The masked email address\n\n#### Examples\n\n```typescript\n// Standard email\nmaskEmail('alice@example.com');\n// 'al****@example.com'\n\n// Short email (shows only first character)\nmaskEmail('ab@test.com');\n// 'a*@test.com'\n\n// Invalid email (returns as-is)\nmaskEmail('notanemail');\n// 'notanemail'\n\nmaskEmail('');\n// ''\n```\n\n## Use Cases\n\n- **Logging**: Mask emails in application logs\n- **UI Display**: Show partial emails in user interfaces\n- **Error Messages**: Display emails in error messages without exposing full addresses\n- **Debugging**: Protect user privacy during development\n\n## License\n\nISC\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n","readmeFilename":"README.md"}