Socket
Socket
Sign inDemoInstall

percentage-diff

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    percentage-diff

Calculate percentage difference between two numbers


Version published
Maintainers
1
Install size
4.17 kB
Created

Changelog

Source

[1.1.0] - 2019-04-24

Added

  • Implement helper toPercentage to return strings with percentage sign appended.

Readme

Source

percentage-diff Build Status codecov

Calculate percentage difference between two numbers

Install

$ npm install percentage-diff

Usage

const percentageDiff = require('percentage-diff');

percentageDiff(50, 75);
//=> 50
percentageDiff.toPercentage(50);
//=> 50%
percentageDiff(45,35);
//=> -22.22

API

percentageDiff(firstNr, secondNr)

firstNr

Type: number

secondNr

Type: number

percentageDiff.toPercentage(value)

value

Type: number

Credits

License

MIT © Rodrigo Bermudez Schettino

FAQs

Last updated on 23 Apr 2019

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc