🚨 Shai-Hulud Strikes Again:More than 500 packages and 700+ versions compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@santi100a/percentage-lib

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@santi100a/percentage-lib

Santi's Powerful Percentage Function: Easily find percentages!

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

Santi's Powerful Percentage Function

Build Status npm homepage GitHub stars License Bundlephobia stats

  • 🚀 Lightweight and fast
  • 👴 ES3-compliant
  • 💻 Portable between the browser and Node.js
  • 📘 Includes TypeScript definitions

What's this?

This is a lightweight, portable NPM package to take the percentage of any number.

$$ P = \frac{1}{100} \cdot n \cdot p $$

Installation

  • Via NPM: npm install @santi100a/percentage-lib
  • Via Yarn: yarn add @santi100a/percentage-lib
  • Via PNPM: pnpm install @santi100a/percentage-lib

API

  • function percentage(num: number, percentage: number): number;

    Calculates the percentage of a given number.

    NameTypeDescriptionOptional?Default
    numnumberThe number for which the percentage needs to be calculated.NoN/A
    percentagenumberThe percentage value to calculate. Must be positive.NoN/A

    Returns the calculated percentage value. Throws a TypeError If num is not a number or percentage is not a number. Throws a TypeError If percentage is not positive.

Usage

const percentage = require('@santi100a/percentage-lib'); // CJS
import percentage from '@santi100a/percentage-lib'; // ESM
import percentage = require('@santi100a/percentage-lib'); // TypeScript

const result = percentage(50, 20);
console.log(result); // Output: 10

Contribute

Wanna contribute? File an issue or pull request! Look at the contribution instructions and make sure you follow the contribution Code of Conduct.

Keywords

santi100a

FAQs

Package last updated on 24 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts