1.0.0 • Published 3 years ago

simple-math-replace.js v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

Simple-Math-Replace.js

It is a simple to use simple math calculations like +, -, /, multiplication. You can also replace strings using this package!

Installation

$ npm install simple-math-replace.js 

Examples For math calculations

const maths = require("simple-math-replace.js");
console.log(maths.cal(15, "*", 3))
// Would log 45
console.log(maths.cal(15, "+", 3))
// Would log 18
console.log(maths.cal(15, "-", 3))
// Would log 12
console.log(maths.cal(2, "/", 15))
// Would log 5

For replacement of strings

let Regex = new RegExp(/hi/gi);
let Str = "Hi How are you. hi hi hi";
console.log(maths.replace(Str, Regex, "hello"));
// This would check all capitalizations of what ever is in our regex, the captalization does not matter because of the "/gi".
//Would log:- hello How are you. hello hello hello

Thank you!