Options
All
  • Public
  • Public/Protected
  • All
Menu

Module source/email

Index

Variables

Variables

Const email

email: { isValid: (str: string) => boolean; remove: (str: string) => string; retrieve: (str: string) => string[]; swap: (str: string, newEmail: string) => string } = ...

Type declaration

  • isValid: (str: string) => boolean
      • (str: string): boolean
      • Takes a string and returns boolean to represent whether or not string is a valid email address

        Basic usage example:

        const email = require('stringman').email; // or `import {email} from 'stringman'`;
        const valid = email.isValid('joey@joeyg.me');
        const invalid = email.isValid('joey-joeyg.me');
        console.log(valid); // true
        console.log(invalid); // false
        

        Parameters

        • str: string

        Returns boolean

  • remove: (str: string) => string
      • (str: string): string
      • Takes a string and returns the string with any email addresses removed

        Basic usage example:

        const email = require('stringman').email; // or `import {email} from 'stringman'`;
        const test = email.remove('my email address is joey@joeyg.me');
        console.log(test); // 'my email address is';
        

        Parameters

        • str: string

        Returns string

  • retrieve: (str: string) => string[]
      • (str: string): string[]
      • Takes a string and returns a valid email address if one is present in the string

        Basic usage example:

        const email = require('stringman').email; // or `import {email} from 'stringman'`;
        const test = email.retrieve('this is my email address joey@joeyg.me');
        console.log(test); // '[joey@joeyg.me]'
        

        Parameters

        • str: string

        Returns string[]

  • swap: (str: string, newEmail: string) => string
      • (str: string, newEmail: string): string
      • Takes 2 strings (a string with an email address and another string that is a different email address) and returns the first string with the new address swapped

        Basic usage example:

        const email = require('stringman').email; // or `import {email} from 'stringman'`;
        const test = email.swap('my email address is joey@joeyg.me', 'test@test.com');
        console.log(test); // 'my email address is test@test.com'
        

        Parameters

        • str: string
        • newEmail: string

        Returns string

Generated using TypeDoc