Skip to main content

Built and signed on GitHub Actions

It is unknown whether this package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
88%
Published
3 weeks ago (0.0.3)

Calculator

Use calculator to perform basic arithmetic operations.

Functions

The calculator module provides the following functions:

add

Adds two numbers.

function add(a: number, b: number): number

Parameters

  • a: The first number.
  • b: The second number.

Returns

The sum of a and b.

subtract

Subtracts the second number from the first number.

function subtract(a: number, b: number): number

Parameters

  • a: The first number.
  • b: The second number.

Returns

The difference between a and b.

multiply

Multiplies two numbers.

function multiply(a: number, b: number): number

Parameters

  • a: The first number.
  • b: The second number.

Returns

The product of a and b.

divide

Divides the first number by the second number.

function divide(a: number, b: number): number

Parameters

  • a: The first number.
  • b: The second number.

Returns

The quotient of a divided by b.

Throws

  • Error if b is 0 (division by zero is not allowed).

square

Squares a number.

function square(x: number): number

Parameters

  • x: The number to be squared.

Returns

The square of x.

License

MIT

Built and signed on
GitHub Actions
View transparency log

Add Package

deno add jsr:@taishira/calculator

Import symbol

import * as mod from "@taishira/calculator";

---- OR ----

Import directly with a jsr specifier

import * as mod from "jsr:@taishira/calculator";

Add Package

npx jsr add @taishira/calculator

Import symbol

import * as mod from "@taishira/calculator";

Add Package

yarn dlx jsr add @taishira/calculator

Import symbol

import * as mod from "@taishira/calculator";

Add Package

pnpm dlx jsr add @taishira/calculator

Import symbol

import * as mod from "@taishira/calculator";

Add Package

bunx jsr add @taishira/calculator

Import symbol

import * as mod from "@taishira/calculator";