simple-libs
v1.0.8
Published
This is library for useful common functions
Readme
Simple Libs
- Install
npm install simple-libs- Learn More
Create Object
const Lib = require("simple-libs")1. String
- remove special chars in string
Lib.String.removeSpecialChars("ABCD1234:'\\//_"); // ABCD1234_;- validate email
Lib.String.isEmail('[email protected]'); // true
Lib.String.isEmail('example-gmail.com'); // false- random string
Lib.String.random(32); // qbjtwnjjsjkresbkwaxyajoxcjbbvradLib.String.random( 25,
Lib.String.RANDOM_STRING_LOWER |
Lib.String.RANDOM_STRING_UPPER |
Lib.String.RANDOM_STRING_DIGIT |
Lib.String.RANDOM_STRING_SPECIAL
); // zL]t!f<tH14l1>($]&Qd]c4RsLib.String.random( 25,
Lib.String.RANDOM_STRING_LOWER |
Lib.String.RANDOM_STRING_UPPER
); // SmBonrGFTiUusBIKaKwVmycpG2. Math
- round
Lib.Math.round(0.225, 2); // 0.253. Email
- InBlue
https://help.sendinblue.com/hc/en-us/articles/209467485-Create-or-delete-an-API-key
Send email via InBlue
const mail = new Lib.Email.InBlue("Your Api Key");
mail.sendMail(
"[email protected]",
"sender name",
["[email protected]"],
"Test subject",
"email text content",
"<div style='text-align:center'><h3>email html content</h3><label>Hello every one</label></div>"
); "engines": {
"node": "18.12.1"
}