Skip to main content
Home

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
a year 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

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@taishira/calculator

Import symbol

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

Import directly with a jsr specifier

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

Add Package

pnpm i jsr:@taishira/calculator
or (using pnpm 10.8 or older)
pnpm dlx jsr add @taishira/calculator

Import symbol

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

Add Package

yarn add jsr:@taishira/calculator
or (using Yarn 4.8 or older)
yarn dlx jsr add @taishira/calculator

Import symbol

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

Add Package

vlt install jsr:@taishira/calculator

Import symbol

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

Add Package

npx jsr add @taishira/calculator

Import symbol

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

Add Package

bunx jsr add @taishira/calculator

Import symbol

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