node-mathematics

1.0.5 • Public • Published

Node Math

Node Math is a Easy, safe, ultra light Mathematical Calculator For Javascript

Mostly Made for discord.js but you can use for other's too!

Usage

//Discord.js
const eval = require("node-mathematics");
const Discord = require('discord.js');
const bot = new Discord.Client();
const prefix = '-' //you can use any prefix you like :)
 
bot.on('ready', async () => console.log('Ready'));
 
bot.on('message', async message => {
    let messageArray = message.content.split(' ');
    let args = messageArray.slice(1);
    if(message.content.startsWith(`${prefix}evaluate`)) {
        let toEval = args.join(' ');
        let result = await eval(toEval);
        message.channel.send(result);
    }
});
// Asynchronous function
(async () => {
    let result = await eval('1+1')
        .catch(e => console.log(e));
    console.log(result);
})();
 
// Synchronous function
(() => {
    let result = eval('1+1')
        .then(r => console.log(r))
        .catch(e => console.log(e));
})();

Facing any problems? let me know! Thanos 2.0#4501

Readme

Keywords

Package Sidebar

Install

npm i node-mathematics

Weekly Downloads

0

Version

1.0.5

License

ISC

Unpacked Size

1.94 kB

Total Files

3

Last publish

Collaborators

  • thansom