UNPKG

everyutil

Version:

A comprehensive library of lightweight, reusable utility functions for JavaScript and TypeScript, designed to streamline common programming tasks such as string manipulation, array processing, date handling, and more.

17 lines (16 loc) 541 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.obscureEmail = void 0; /** * Obscures an email address, hiding all but the first character and domain. * * Example: obscureEmail("john.doe@gmail.com") → "j***@gmail.com" * * @author @dailker * @param {string} email - The email address to obscure. * @returns {string} The obscured email. */ function obscureEmail(email) { return email.replace(/^(.).+(@.+)$/, (_, a, b) => a + '***' + b); } exports.obscureEmail = obscureEmail;