# mathops

> Contains functions implementing basic operators of Javascript

Latest version **1.0.0** (published 2014-08-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install mathops
pnpm add mathops
yarn add mathops
bun add mathops
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2014-08-25 |
| First published | 2014-08-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Philip Woods |
| Maintainers | elzair |
| Keywords | math, operators, functionalprogramming |

## Links

- npm: https://www.npmjs.com/package/mathops
- Repository: https://github.com/Elzair/mathops
- Issues: https://github.com/Elzair/mathops/issues
- npm.io page: https://npm.io/package/mathops

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2014-08-25
- 0.1.0 — 2014-08-23

## README

# mathops

This module contains functions that implement the basic operators of Javascript: the mathematical operators (+, -, ...), the arithmetic operators (++, --, ...), the bitwise operators (^, ~, ...), the logical operators (&&, ||, ...), and the comparison operators (>, <, ...). It is similar to the [operator](https://docs.python.org/2/library/operator.html) library from Python.

## Installation

To install **mathops** into your project, first `cd` to your project directory; then type the following.

    npm install mathops --save

## Use

Simply require **mathops** in your project and call any of its functions.

```javascript
var operator = require('mathops');

console.log(operator.add(5, 3));
```

## API

This is a list of all the functions supported by mathops and their base operator equivalents.

### Base Mathematical Operators

* **add(x, y)**: "x + y"
* **sub(x, y)**: "x - y"
* **mul(x, y)**: "x * y"
* **div(x, y)**: "x / y"
 
### Arithmetic Operators

* **mod(x, y)**: "x % y"
* **inc(x)**: "++x"
* **dec(x)**: "--x"
* **neg(x)**: "-x"

### Bitwise Operators

* **and(x, y)**: "x & y"
* **or(x, y)**: "x | y"
* **xor(x, y)**: "x ^ y"
* **not(x)**: "~x"
* **lshift(x, y)**: "x << y"
* **rshift(x, y)**: "x >> y"
* **zrshift(x, y)**: "x >>> y"

### Logical Operators

* **land(x, y)**: "x && y"
* **lor(x, y)**: "x || y"
* **lnot(x)**: "!x"

### Comparison Operators

* **eq(x, y)**: "x == y"
* **neq(x, y)**: "x != y"
* **steq(x, y)**: "x === y"
* **stneq(x, y)**: "x !== y"
* **gt(x, y)**: "x > y"
* **ge(x, y)**: "x >= y"
* **lt(x, y)**: "x < y"
* **le(x, y)**: "x <= y"

### Testing

To run the included unit tests, type the following command.

    npm test

---
_Source: https://npm.io/package/mathops · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
