/Mathball

An npm package for competitive programming in JavaScript!

Primary LanguageJavaScriptMIT LicenseMIT

Introduction

npm version Build Status Known Vulnerabilities codecov Codacy Badge PRs Welcome License: MIT

Mathball is an npm package for competitive programming in JavaScript with a focus on common mathematical utilities being implemented in relevant algorithms & data structures for optimized performance!

JavaScript was never built while keeping competitive coding in mind; let us all agree on that. But, the stuff that we build with it today was not something it was built for either! Back in 1995, Brendan Eich developed JavaScript only for adding interactivity to web pages like handling a mouse click. Today, we can build servers, games, mobile apps, IoT apps and even machine learning in the browser is possible with JavaScript.

"Any application that can be written in JavaScript, will eventually be written in JavaScript." -- Atwood's Law.

Based on the notion - JS is everywhere! I also believe that maybe its time to motivate people who are well versed with this language to finally consider it in the realm of competitive programming.

Installation

You can download the package in your working directory by simply typing in the terminal (for Mac/Linux users) or command prompt (for Windows users):

$ npm install mathball --save

Features

Examples

You can access all the utilities via mathball object, M (or whatever you end up calling it) like so:

let M = require('mathball');

console.log(M.isPalindrome(1551))       //true
console.log(M.isEven(7))		//false
console.log(M.sum([4, 5, 9]))		//18

Or, you can directly access an individual function as given below:

let gcd = require('mathball/lib/gcd');

console.log(gcd([12, 18, 24]));		//6

Contribution

  1. Fork the project. 🍴
  2. Fix issues & add changes. 🔧
  3. Follow the guidelines given in CONTRIBUTING.md. 🌟
  4. Make a PR. 🔨
  5. Mission Acomplished! 🎉

Important Notice

Mathball has been selected at GirlScript Summer of Code 2019!

License

The MIT License 2019 - Priyabrata Biswas.