0.1.0 โ€ข Published 2 months ago

@arungovil/sanitize-js v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Installation

Using npm

npm i @arungovil/sanitize-js

Using Yarn

yarn add @arungovil/sanitize-js

Usage

import { sanitize } from "@arungovil/sanitize-js";

const email = "arun(๐Ÿž)govil@duck.com";

const sanitizedEmail = sanitize(email);

Result

โŒ Before
arun(๐Ÿž)govil@duck.com 

โœ… After
arungovil@duck.com 

Parameters

Options

Examples

Using custom regex

Pass a custom regex to strip out matching characters.

import { sanitize } from "@arungovil/sanitize-js";

const email = "arun(๐Ÿž)govil@duck.com";
const myRegex = /#/g; // regex to strip out #

const sanitizedEmail = sanitize(email, { customRegex: myRegex  });

Result

โŒ Before
arun#govil@duck.com 

โœ… After
arungovil@duck.com 

Sanitize non email strings

To sanitize only the username of an email or a random string

import { sanitize } from "@arungovil/sanitize-js";

const userName = "arun(๐Ÿž)govil";

const sanitizedUserName = sanitize(userName, { isNormalString: true  });

Result

โŒ Before
arun(๐Ÿž)govil

โœ… After
arungovil 

Note

Sanitize-js is used for email sanitization, if you are looking for an email validator use validator.js

0.0.95

2 months ago

0.0.85

2 months ago

0.0.75

2 months ago

0.1.0

2 months ago

0.0.9

2 months ago

0.0.8

2 months ago

0.0.7

2 months ago

0.0.6

2 months ago

0.0.5

2 months ago

0.0.3

2 months ago

0.0.2

2 months ago

0.0.1

2 months ago